On Tue, Jun 28, 2005 at 05:00:57PM +0000, Levy, Chen wrote:
> Hi list.
>
> Consider the following script:
>
> ----------
> #!/bin/bash
>
> n=5
> echo "init: $n"
>
> seq 10 |
"""
And thus everything after it is the second part of a pipe and is run in
a subshell, rather than in the same shell.
> while read x ; do
> n=$((n + 1))
> echo -n "$$ $n : "
> done
In bash(1) I see:
$ Expands to the process ID of the shell. In a () subshell, it
expands to the process ID of the current shell, not the sub‐
shell.
> init: 5
> 14553 6 : 14553 7 : 14553 8 : 14553 9 : 14553 10 : 14553 11 : 14553 12 :
> 14553
> 13 : 14553 14 : 14553 15 :
> after while: 5
--
Tzafrir Cohen | [EMAIL PROTECTED] | VIM is
http://tzafrir.org.il | | a Mutt's
[EMAIL PROTECTED] | | best
ICQ# 16849755 | | friend
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]