🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #1134

Stuff running in subshells can be annoying

#1134
From: Brian Fox
Date: Thu, 11 Jan 1990 19:52
29 lines
1542 bytes
   Date: 8 Jan 90 14:11:38 GMT
   From: utgpu!watserv1!watcgl!andrewt@jarvis.csri.toronto.edu  (Andrew Thomas)
   Organization: University of Waterloo, Waterloo, Ontario, Canada
   Sender: bug-bash-request@prep.ai.mit.edu

   I have a simple function:

   function restart ()
     {
       eval `jobs | fgprg $1`
     }

   which used to work in bash 1.03.  It seems now that stuff in `` or $()
   gets run in a subshell in 1.04 where there aren't really any jobs.  Is
   this fixable?

   Am I sadly out to lunch on this diagnosis? :-)

You are not out to lunch on this diagnosis.  However, builtins that are
piped are run in a subshell, as are builtins that are explicitly run in
subshells, either with (jobs) or `jobs`.  This means that they only have
access to the information that is present in subshells, which
unfortunately, doesn't include which jobs the parent is running.  Maybe
this could be hacked in.

I think it is interesting to see what /bin/csh does with "jobs | more".

Brian
Technical Details
Message-ID: <9001111952.AA01667@sbphy.Ucsb.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!samsung!think!bbn!mephisto!tut.cis.ohio-state.edu!sbphy.ai.mit.edu!bfox
References: <ANDREWT.90Jan8091138@watnow.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!samsung!think!bbn!mephisto!tut.cis.ohio-state.edu!sbphy.ai.mit.edu!bfox
From: bfox@sbphy.ai.mit.edu (Brian Fox)
Newsgroups: gnu.bash.bug
Subject: Stuff running in subshells can be annoying
Message-ID: <9001111952.AA01667@sbphy.Ucsb.EDU>
Date: 11 Jan 90 19:52:50 GMT
References: <ANDREWT.90Jan8091138@watnow.waterloo.edu>
Sender: bilbo@tut.cis.ohio-state.edu
Reply-To: bfox@ai.mit.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 29