HI
> If you check the bash manpage $$ will not give you the subshell - at least
> when using ().
> The 3rd read may occur, but the loop won't run because that read fails so f
> is not blanked afaict.
> Rodolfo, when you did set -x, your output was different to mine.
set -x turns on echo'ing; set +x does the opposite. I'd thought the
goal was to print foo|bar|baz but nevermind ;-D
i...@sheila:~$ set -x; echo "foo|bar|baz" | awk 'BEGIN{RS="|"}{ print
$1 }' | while read s; do echo $s; f=$s; done;
+ awk 'BEGIN{RS="|"}{ print $1 }'
+ read s
+ echo 'foo|bar|baz'
+ echo foo
foo
+ f=foo
+ read s
+ echo bar
bar
+ f=bar
+ read s
+ echo baz
baz
+ f=baz
+ read s
++ echo -ne '\033]0;i...@interrupt: ~\007'
On zsh-
[...@sheila:~]$ set -x; echo "foo|bar|baz" | awk 'BEGIN{RS="|"}{ print
$1 }' | while read s; do echo $s; f=$s; done;
+-zsh:115> echo 'foo|bar|baz'
+-zsh:115> awk 'BEGIN{RS="|"}{ print $1 }'
+-zsh:115> read s
+-zsh:115> echo foo
foo
+-zsh:115> f=foo
+-zsh:115> read s
+-zsh:115> echo bar
bar
+-zsh:115> f=bar
+-zsh:115> read s
+-zsh:115> echo baz
baz
+-zsh:115> f=baz
+-zsh:115> read s
Just my 2 cents.
--
Regards,
Ishwor Gurung
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html