[SunHELP] stty erase

Brian Hechinger sunhelp at sunhelp.org
Thu Mar 29 21:58:41 CST 2001


> This might not work for solaris awk.  I know it works for GNU awk.

i like to avoid GNU products so that i don't lose portability.  sometimes GNU
just isn't a viable solution, sure, that's a purists view since i've personally
never seen a situation where GNU is banned, but, well, call me old-school. :)

>> TTY=`tty | cut -c 6-`
>> who | grep $TTY | awk 'BEGIN { FS="(" } {print $2}' | cut -d . -f 1
>
> who|grep $TTY |awk -F "(" '{print$2}"| cut -d . -f 1

i was thinking more along the lines of:

let's examine my original "script".  there are two calls to 'cut', one to 
'grep', one to 'awk', one to 'tty' and one to 'who'.

now, we can't really avoid the calls to tty and who, but do we really need to 
call four other programs to do this when we are already calling awk which is an 
extensively powerful tool.  so i guess what i was saying by "cleaning up" was 
to remove those extra calls as much as possible.  would it be possible to write 
the entire thing in awk?  i would assume the answer is yes, and if i had an awk
book handy i'd figure it out.

old-school?   *raises hand*    that would be me.   :)

-brian



More information about the SunHELP mailing list