Path: utzoo!attcan!uunet!lll-winken!ubvax!vsi1!v7fs1!mvp From: mvp@v7fs1.UUCP (arf) Newsgroups: comp.unix.wizards Subject: Script to set parent environment Summary: Summary of responses Message-ID: <186@v7fs1.UUCP> Date: 17 Jan 89 23:28:27 GMT Reply-To: mvp@v7fs1.UUCP (arf) Organization: Video7, Cupertino, CA Lines: 40 Some time ago I asked about how a csh script could change global environment variables. Thanks to everyone who responded. Here's a summary: You can't do it, and this question should be added to the "List of Most Frequently Asked Questions". At least, there's no official way, because to do that requires a child to change its parent's environment, and that's a no-no. A couple of messages implied that it might be possible, if one were to play some "Real Programmer" type games. Many replies also said that if I wanted to call a script to set some environment variables, I should either "source" the script ( . in sh) or create an alias. (I had ruled out sourcing the script because you can't pass arguments to a sourced script.) chris@mimsy.UUCP (Chris Torek) suggested a script which generates and then prints the desired setenv command on standard output, and an alias > % alias edit-env 'eval `~/bin/edit-env`' to make the current shell do the actual setenv. This works fine, but doesn't work for the specific problem I was trying to solve -- a script which saves its argument list, and if called with no arguments, uses the old argument list. (Perhaps I should have specified what I was trying to do more exactly.) The way I finally kludged it was more along the lines of if $#argv > 0 then echo $* >~/.last-parms endif program-call `cat ~/.last-parms` -- Mike Van Pelt "Hey, hey, ho ho, Video 7 Western culture's got to go." ...ames!vsi1!v7fs1!mvp Stanford students and faculty.