tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: $$ broken??
On Mon, 25 Mar 2013 15:29:03 -0400 (EDT)
Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
> > $ pid=$(sh -c 'ps -oppid -p $$')
> > $ pid=${pid#PPID }
>
> Ooh, nice! Thank you.
>
> > Although some old versions of sh don't like the space in that
> > pattern.
>
> At worst, and at the cost of another process,
>
> ps -oppid -p $$ | sed -e 1d
or without the extra fork:
ps -o ppid= -p $$
>
> /~\ The ASCII Mouse
> \ / Ribbon Campaign
> X Against HTML mouse%rodents-montreal.org@localhost
> / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index