Help me with a simple sed script please!

Guy Harris guy at auspex.auspex.com
Wed Mar 27 05:07:42 AEST 1991


>	set remote = `who am i | sed -n 's/^.*\(([^)]*:[^)]*)\).*$/\1/p'`

Not quite.  Works fine if you're running from, say, an "xterm"; doesn't
work so fine if you're remotely logged in (i.e., it depends on an
"xterm"-style entry being in the parentheses, with a host name, colon,
and display name, and doesn't work if there's just a host name there). 
If you're running from an "xterm", DISPLAY should already be set....

Of course, even if you change it to handle "rlogin"/"telnet" entries, it
may not do what you want if you remotely log in to machine A from your
workstation and then remotely log into machine B from machine A, because
it'll set DISPLAY to refer to machine A, not to your workstation....



More information about the Comp.unix.internals mailing list