Results 1 to 6 of 6
Hi all,
I was using a export to export the variable. but each time when i execute the script, my terminal will exit. here is the code
file1.sh - contents
...
- 11-18-2008 #1Just Joined!
- Join Date
- Aug 2008
- Posts
- 49
export problem???
Hi all,
I was using a export to export the variable. but each time when i execute the script, my terminal will exit. here is the code
file1.sh - contents
echo the value exported by the shell is $var
var=newvalue
export var
exec /root/file2.sh
file2.sh - contents
echo "the value is $var"
Each time when i execute the file1.sh, my teminal will exit...
why is this???
- 11-18-2008 #2Just Joined!
- Join Date
- Nov 2008
- Posts
- 26
Which shell are you using? Korn? Boune? bash? some other? Anyway, this is a usage of "exec" that I've not encountered, and it's likely the bad guy
- 11-18-2008 #3Just Joined!
- Join Date
- Nov 2008
- Posts
- 26
Another possibility (a long shot) ... that script DOES say "exec" and not "exit" - right?
- 11-18-2008 #4Just Joined!
- Join Date
- Aug 2008
- Posts
- 49
Hi...
I am using bash... its "exec" only... if execute
sh file1.sh
immediately, it will exit from the current terminal.
- 11-18-2008 #5Just Joined!
- Join Date
- Oct 2008
- Posts
- 10
at first sight there is no problem, when you execute "exec", file1.sh finishes and file2.sh starts executing, so it should print "the value is newvalue"
I have tried it on my machine and it works...
- 11-18-2008 #6Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )


Reply With Quote
