🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Ray Nickson Thu, 24 Aug 1989 23:07
confusion when bash executes shell scripts
#504
Author: Ray Nickson
Date: Thu, 24 Aug 1989 23:07
17 lines
1308 bytes
If I execute a shell script for which I have execute permission, but
which does not start with #!, bash runs it itself (via a recursive
call on main() !!).  This is fine, except that if the parent bash is a
login shell, so is the forked child, and it runs .profile.  I was
burned by this when I included `. ~/.bashrc' in my .profile; one of
the commands that .bashrc ran was a script ...  (my solution was simply
to start using a .bash_profile instead).

Any reason not to just zero the login_shell variable and remove the -
from argv[0] before calling main()?  You might also want to
act_like_sh in this case (if you don't already) - does this have any
impact other than on what startup files are run?

-rgn
--
Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand
nickson@comp.vuw.ac.nz       ...!uunet!vuwcomp!nickson      + 64 4 721000x8593
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads