Path: utzoo!attcan!uunet!munnari!djk From: djk@munnari.oz (David James Keegel) Newsgroups: comp.unix.wizards Subject: Re: Script to set parent environment Message-ID: <2639@munnari.oz> Date: 22 Jan 89 13:11:03 GMT References: <186@v7fs1.UUCP> Organization: Comp Sci, Melbourne Uni, Australia Lines: 43 in article <186@v7fs1.UUCP>, mvp@v7fs1.UUCP (arf) says: ] ] Some time ago I asked about how a csh script could change ] global environment variables. Thanks to everyone who responded. ] ... ] [Chris Torek's suggestion] 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.) Yes, you should. A general solution for this is hard, a specific one is reasonably easy. ] 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` I deduce from this that you are using C-shell. Well, my .cshrc contains the following: alias to 'set to=\!^; \to' \!^ "'\!:2*'" alias ot '\to "$to"' "'\!*'" There is a horrible confusion of quotes and backslashes here, but the point is that when I run `to' (usage: "to user message ..."; like "echo message | write user"), it saves the user name in the variable $to, and I can use "ot" to recover it. So these are equivalent: % to fred hi there % to fred hi there % to fred how are you % ot how are you If you don't like the waste of file space from the shell script and ~/.last-parms, and you can be bothered, you feel free to adapt this idea. -- David Keegel (djk@munnari.oz) "Flattery will get you nowhere, unless someone else does it to you"