tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: $$ broken??



> If you have a ps(1) newer than 2006-10-02, then:

> pid=$(sh -c 'ps -o ppid= -p $$')

Actually that works fine even on my 1.4T machines (some six to seven
years before that date, IIRC).  It does require that $pid is used
without quotes, to make the whitespace go away, but that's how I was
using it anyway.

I'd also use ` ` rather than $( ), but that's mostly a personal
idiosyncracy, and it works either way, even with the 1.4T sh.

/~\ 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