🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #541

confusion when executing shell scripts

#541
From: Brian Fox
Date: Mon, 04 Sep 1989 07:35
32 lines
1800 bytes
   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.  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


Are you sure?  I am sure that this is not the case.

Brian
Technical Details
Message-ID: <8909040735.AA17253@aurel.caltech.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
References: <8909040112.AA21395@comp.vuw.ac.nz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!AUREL.CALTECH.EDU!bfox
From: bfox@AUREL.CALTECH.EDU (Brian Fox)
Newsgroups: gnu.bash.bug
Subject: confusion when executing shell scripts
Message-ID: <8909040735.AA17253@aurel.caltech.edu>
Date: 4 Sep 89 07:35:14 GMT
References: <8909040112.AA21395@comp.vuw.ac.nz>
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: bfox@aurel.caltech.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 32