Article View: gnu.bash.bug
Article #558Re: confusion when executing shell scripts
From: Ray Nickson
Date: Mon, 04 Sep 1989 23:26
Date: Mon, 04 Sep 1989 23:26
67 lines
2281 bytes
2281 bytes
From: bfox@aurel.caltech.EDU
Date: Mon, 4 Sep 89 00:35:14 PDT
Date: Mon, 04 Sep 89 13:10:57 +1200
From: Ray Nickson <nickson@comp.vuw.ac.nz>
The following bug which I reported in version 1.02 does not seem to have
gone away in 1.03.
From: Ray Nickson <nickson@comp.vuw.ac.nz>
Date: Fri, 25 Aug 89 11:07:10 +1200
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.
[ ... ]
Are you sure? I am sure that this is not the case.
Brian
Unless I'm doing something very wrong, it is still the case.
I removed my .bash_profile and my .bashrc.
.profile contains only the line
echo "running .profile"
and /bin/true is
exit 0
Then I get
bash$ bash-1.03 -login
running .profile
bash$ type true
true is /bin/true
bash$ true
running .profile
logout
If I change .profile to
echo "running .profile, SHLVL=" $SHLVL
true
Then I get
bash$ bash-1.03 -login
running .profile, SHLVL= 2
bash$ type true
true is hashed (/bin/true)
bash$ true
running .profile, SHLVL= 3
running .profile, SHLVL= 4
running .profile, SHLVL= 5
.. etc.
I do not know where `logout' comes from in the first case nor why the
profile does not run recursively as soon as I type bash-1.03 -login in
the second case.
bash-1.03 is GCC compiled on an HP300 running More/BSD, and I can
reproduce the problem in a similar way in 1.02 on a Sun3/80 running
SunOS4.
-rgn
--
Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand.
nickson@comp.vuw.ac.nz ...!uunet!vuwcomp!nickson + 64 4 721000x8593
Technical Details
Message-ID:
<8909042328.AA14013@comp.vuw.ac.nz>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!iuvax!purdue!tut.cis.ohio-state.edu!comp.vuw.ac.nz!nicksonReferences:
<8909040735.AA17253@aurel.caltech.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!iuvax!purdue!tut.cis.ohio-state.edu!comp.vuw.ac.nz!nickson From: nickson@comp.vuw.ac.nz (Ray Nickson) Newsgroups: gnu.bash.bug Subject: Re: confusion when executing shell scripts Message-ID: <8909042328.AA14013@comp.vuw.ac.nz> Date: 4 Sep 89 23:26:08 GMT References: <8909040735.AA17253@aurel.caltech.edu> Distribution: gnu Organization: GNUs Not Usenet Lines: 67