Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.internals Subject: Re: Help me with a simple sed script please! Message-ID: <1991Mar21.203343.3522@athena.mit.edu> Date: 21 Mar 91 20:33:43 GMT References: <1991Mar21.111919.4126@resam.dk> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 38 In article <1991Mar21.111919.4126@resam.dk>, andrew@resam.dk (Leif Andrew Rump) writes: |> set remote = `who am i | grep "("` set remote = `who am i | sed -n 's/^.*\(([^)]*:[^)]*)\).*$/\1/p'` |> if "$remote" != "" then |> setenv DISPLAY cphxd3:0.0 |> endif if ("$remote" != "") then setenv DISPLAY "$remote" endif |> I would like to make this shell script "global" so everybody could use it, You might want to read the section of the comp.unix.questions FAQ which discusses why shell scripts can't change their parents' environments. Unless you're planning on making this a file that people "source", rather than running as an executable shell script. If you don't have a copy of the FAQ and it has expired at your site, see the end of this message for instructions on how to get it. -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710 1. Via anonymous ftp from pit-manager.mit.edu (18.72.1.58), in the file /pub/usenet/comp.unix.questions/Frequently_Asked_Questions_about_Unix_-_with_Answers_[Monthly_posting] 2. Via mail archive server. Send mail to mail-server@pit-manager.mit.edu with a subject of send usenet/comp.unix.questions/Frequently_Asked_Questions_about_Unix_-_with_Answers_[Monthly_posting]