[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash cannot kill itself?
From: |
Chris F.A. Johnson |
Subject: |
Re: Bash cannot kill itself? |
Date: |
Wed, 30 Jun 2010 02:42:00 -0400 (EDT) |
User-agent: |
Alpine 2.00 (LMD 1167 2008-08-23) |
On Wed, 30 Jun 2010, Clark J. Wang wrote:
> On Wed, Jun 30, 2010 at 1:40 PM, Jan Schampera <jan.schampera@web.de> wrote:
>
> > Clark J. Wang wrote:
> >
> > Running a cmd in background (by &) would not create subshell. Simple
> >> testing:
> >>
> >> #!/bin/bash
> >>
> >> function foo()
> >> {
> >> echo $$
> >> }
> >>
> >> echo $$
> >> foo &
> >>
> >> ### END OF SCRIPT ###
> >>
> >> The 2 $$s output the same.
> >>
> >
> > This doesn't mean that it doesn't create a subshell. It creates one, since
> > it can't replace your foreground process.
> >
> > This makes sense.
>
> It just shows that $$ does what it should do, it reports the relevant PID of
> > the parent ("main") shell you use.
>
>
> Then what's the problem with my script in my original mail? Seems like Bash
> does not handle the signal in a real-time way.
The special variable $$ refers to the current process, even if it
has the same numeric value as the parent script.
--
Chris F.A. Johnson, <http://cfajohnson.com>
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
- Bash cannot kill itself?, Clark J. Wang, 2010/06/30
- Re: Bash cannot kill itself?, Chris F.A. Johnson, 2010/06/30
- Re: Bash cannot kill itself?, Clark J. Wang, 2010/06/30
- Re: Bash cannot kill itself?, Chris F.A. Johnson, 2010/06/30
- Re: Bash cannot kill itself?, Jan Schampera, 2010/06/30
- Re: Bash cannot kill itself?, Clark J. Wang, 2010/06/30
- Re: Bash cannot kill itself?, Jan Schampera, 2010/06/30
- Re: Bash cannot kill itself?, Clark J. Wang, 2010/06/30
- Re: Bash cannot kill itself?,
Chris F.A. Johnson <=
- Re: Bash cannot kill itself?, Pierre Gaston, 2010/06/30
- Re: Bash cannot kill itself?, Pierre Gaston, 2010/06/30
- Re: Bash cannot kill itself?, Clark J. Wang, 2010/06/30
Re: Bash cannot kill itself?, Andreas Schwab, 2010/06/30