UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 11th, 2006, 06:57 AM
jm58 jm58 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 5 jm58 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 6 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old June 11th, 2006, 01:48 PM
Ehlanna's Avatar
Ehlanna Ehlanna is offline
Not a clue what to put ...
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2006
Location: in front of this keyboard
Posts: 815 Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 5 h 43 m 48 sec
Reputation Power: 243
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
plese note the space after the dot.
__________________
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?
.

Reply With Quote
  #3  
Old June 12th, 2006, 04:08 AM
jm58 jm58 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 5 jm58 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 6 sec
Reputation Power: 0
Quote:
Originally Posted by Ehlanna
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
plese note the space after the dot.



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

Reply With Quote
  #4  
Old June 12th, 2006, 11:40 AM
Ehlanna's Avatar
Ehlanna Ehlanna is offline
Not a clue what to put ...
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2006
Location: in front of this keyboard
Posts: 815 Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level)Ehlanna User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 5 h 43 m 48 sec
Reputation Power: 243
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.

Reply With Quote
  #5  
Old June 13th, 2006, 02:01 AM
jm58 jm58 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 5 jm58 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 6 sec
Reputation Power: 0
i will try
10x

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Working with exec in ksh


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT