Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.internals Subject: Re: Help me with a simple sed script please! Message-ID: <6831@auspex.auspex.com> Date: 26 Mar 91 19:07:42 GMT References: <1991Mar21.111919.4126@resam.dk> <1991Mar21.203343.3522@athena.mit.edu> Organization: Auspex Systems, Santa Clara Lines: 12 > 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....