ork in BASH4 and BASH3. Again, Many thanks.
Yair.
-Original Message-
From: Chet Ramey [mailto:chet.ra...@case.edu]
Sent: Thursday, April 11, 2013 2:03 PM
To: Lenga, Yair [ICG-MKTS]
Cc: 'chet.ra...@case.edu'; 'Dan Douglas'; 'bug-bash@gnu.org'
Subject: Re: Possib
On 4/11/13 12:15 PM, Lenga, Yair wrote:
> Dan, Chet: Many thanks for the info about BASHPID.
>
> I've checked BASHPID on RH6, and it looks OK. Few comments related to making
> the change visible, and POSIX compliance.
>
> + The 'set' command, does not print the BASHPID, this make it very hard t
On Thursday, April 11, 2013 04:15:45 PM Lenga, Yair wrote:
> ( echo "$!") &
> ( echo "$!") &
>
> According to POSIX, both calls should print "" (nothing). As the background
> command does not come from the "current" shell.
>
> With BASH4, The first call will print "" (nothing), second call will p
On Thu, Apr 11, 2013 at 04:15:45PM +, Lenga, Yair wrote:
> + The man page list BASH_VERSION, etc., but no indication of BASHPID. It's
> probably a good idea to put a note next to '$!' about BASHPID.
It is certainly in the man page:
BASHPID
Expands to the process ID of the c
ably conflict with POSIX standard which
indicate that "$!" apply to "CURRENT" shell.
Thanks
Yair
-Original Message-
From: Chet Ramey [mailto:chet.ra...@case.edu]
Sent: Thursday, April 11, 2013 10:14 AM
To: Lenga, Yair [ICG-MKTS]
Cc: Dan Douglas; bug-bash@gnu.org; chet.ra.
On 4/11/13 9:24 AM, Dan Douglas wrote:
> On Thursday, April 11, 2013 01:05:43 PM Lenga, Yair wrote:
>> With BASH 3.0, the backgrounded task could access the PID of the parent using
>> "$$", and the PID Of itself as "$!".
>>
>> With BASH 4.0, the script fail, the "$!" is not available to the child
>
On Thursday, April 11, 2013 01:05:43 PM Lenga, Yair wrote:
> With BASH 3.0, the backgrounded task could access the PID of the parent using
> "$$", and the PID Of itself as "$!".
>
> With BASH 4.0, the script fail, the "$!" is not available to the child
> process.
>
> Is it possible to add back th
On Thu, Apr 11, 2013 at 01:05:43PM +, Lenga, Yair wrote:
> Is it possible to add back the functionality to allow the child process to
> somehow retrieve it's OWN PID.
You are looking for the BASHPID variable, which expands to the process
ID of the current bash process (even in a subshell).
Hi,
I'm using a bash scripts that is running one of the functions in the scripts as
a "background".
function my_func {
MAINPID=$$ # Does not work, report PID of main process.
MYPID=$! # Work with bash 3.0, return "unbound" value for bash 4.0
echo "Deamon run as PID=$MY