|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Working with exec in ksh
hi
i have a script in this script i need to invoke another one that should set some environment vars i tried using the exec command from my script but the program is exiting after the second script (that was executed with exec) how can i set the env vars ( or invoke the second script) without exiting the code looks like the following: ####my_script #!/bin/ksh echo "before ld_path = $LD_LIBRARY_PATH" exec ~/scond_script echo "after ld_path = $LD_LIBRARY_PATH" exit ### second_script #!/bin/ksh export LD_LIBRARY_PATH_64=blabla 10x in advance |
|
#2
|
||||
|
||||
|
exec will run the command in the same process as the calling process, and thus an exit will terminate that process.
What you wish to do is to source the seconf scritp using the . command (yes, that is a dot): Code:
. ~/scond_script
__________________
According to Sod's Law, buttered toast lands butter side down, when dropped. Per nature, cats always land on their feet. So, what happens when you strap buttered toast to the back of a cat and throw it out a window?. |
|
#3
|
|||
|
|||
|
Quote:
i am using now the ssource command in ksh (". ") but now i have a new problem my second script is tcsh and have its syntax and i get syntax error while executing what do i need to do 10x |
|
#4
|
||||
|
||||
|
I thought you said the second script was ksh (as in the shebang line at the start stating /bin/ksh).
I am not sure what the rules of sharing environment variables between shells are. I suspect you may need to source the file one more, in the tcsh script to re-setup the variables. |
|
#5
|
|||
|
|||
|
i will try
10x |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Working with exec in ksh |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|