* Erik Christiansen on Monday, November 29, 2010 at 22:44:10 +1100 > On Mon, Nov 29, 2010 at 11:47:16AM +0100, Christian Ebert wrote: >> * Christian Ebert on Monday, November 29, 2010 at 11:11:11 +0100 >>> term="/dev/$(ps -p$$ | awk '!/PID/ { print $2 }')" >> >> awk 'END { print $2 }' >> >> is better. > > Since both select the desired line from the two lines presented by the > ps invocation, they do appear equivalent. > > Despite being a long-term fan of awk, I would though offer an awk-less > means of providing $2, in case the extra command offends, in any form. > Since this: > > term="/dev/$(ps -p $$ -o tty=)" > > provides (only) $2 in the same format as the more vanilla ps invocation > above, it seems to do the job a little more directly.
Indeed. a) I was too lazy to look it up. b) I have no clue about portability - unless I find it does not work on my system. ;-) c -- theatre - books - texts - movies Black Trash Productions at home: http://www.blacktrash.org Black Trash Productions on Facebook: http://www.facebook.com/blacktrashproductions