From: Moody on 13 Jan 2010 03:49 On Jan 12, 6:52 pm, Stephane CHAZELAS <stephane_chaze...(a)yahoo.fr> wrote: > 2010-01-12, 00:04(+00), Kevin Collins: > [...]> The problem above is that the '$$' in '(echo $$)' is expanded by the parent > > shell before the sub-shell is spawned, which is why the same value shows up. I > > can't think of a way to get the desired test accomplished :) > > [...] > > No, it's not, it's expanded by the subshell that may or may not > be a child process. Any other pid than $$ and $! are the shell's > internal cuisine's, one shouldn't need to deal with those. > > You can always use: > > sh -c '...whatever with "$$"...' > > if you want to start a new shell and have a different $$. > > -- > Stéphane Yes, It works like I needed... $ echo $$ 21320 $ sh -c 'echo $$' 21348 $ thanks. BB
First
|
Prev
|
Pages: 1 2 3 4 5 Prev: select last field of line (cut/sed/awk etc) Next: m to n or just n |