On Tue, Oct 14, 2008 at 04:12:31PM -0500, Steven S. Critchfield wrote: > > I am not certain, but I think so. One of the problems with > . <file> running of apps is when the script issues an exit > command. The NVIDIA driver install package does this. > Nothing more fun than suing to root and using . <file> to > avoid chmoding the file and it exits and exits your root > shell when you have to fix a problem and reinstall.
./source run the named script in the same process context as
the current shell, be it a login shell or something that's been
exec'd by your login shell; so the "exit" is executed in the context
of the login shell itself, not as a subshell.
If you, as root or any other user, ./source a script containing:
echo "about to bail"
exit
from a login shell you will indeed be logged out as the exit
takes effect in your login shell.
If you execute the same snippet from within a subshell, such
as calling the above code in another script and then run that
other script from a command-line you should not be logged out
as the exit is executing in the process context of the subshell.
However, if you ./source the other script, same rules as earlier
apply; the exit is executed in the context of your login shell.
Had the example nvidia install script been executed as
"sh /path/to/script" it would not have been an issue.
John
--
"I'm sorry but our engineers do not have phones."
As stated by a Network Solutions Customer Service representative when asked to
be put through to an engineer.
"My other computer is your windows box."
Ralf Hildebrandt
<sxem> trying to play sturgeon while it's under attack is apparently not fun.
pgpNoxF0aSE0D.pgp
Description: PGP signature
