Help me with a simple sed script please!

Jonathan I. Kamens jik at athena.mit.edu
Fri Mar 22 06:33:43 AEST 1991


In article <1991Mar21.111919.4126 at resam.dk>, andrew at 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 at 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 at pit-manager.mit.edu
   with a subject of

   send usenet/comp.unix.questions/Frequently_Asked_Questions_about_Unix_-_with_Answers_[Monthly_posting]



More information about the Comp.unix.internals mailing list