[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $$ not always returning the current PID
From: |
Chet Ramey |
Subject: |
Re: $$ not always returning the current PID |
Date: |
Mon, 25 Feb 2002 08:35:42 -0500 |
> Lectori Salutem,
>
> During the write of a bash shell script I encountered the following problem,
> i really don't know if i should call it a bug.
>
> The script which demonstrates the problem is:
> ---------------------------------------------
> #!/bin/bash
>
> echo_pid() { echo "(Inner script) ${$}"; }
>
> echo "Outer script: ${$}"
> echo_pid &
> echo "Outer script: ${!}"
> ---------------------------------------------
In a subshell, $$ expands to the same thing as in the parent shell.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/