Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!uiucdcs!carroll From: carroll@cs.uiuc.edu (Alan M. Carroll) Newsgroups: comp.lang.c Subject: Re: Setting environment from inside a pg. Keywords: C, environment, DOS Message-ID: <1990Nov27.235330.851@ux1.cso.uiuc.edu> Date: 27 Nov 90 23:53:30 GMT References: Sender: news@ux1.cso.uiuc.edu (News) Reply-To: carroll@cs.uiuc.edu (Alan M. Carroll) Distribution: usa Organization: Technophiles Inc. - Engineers with Attitude Lines: 23 Here is how you set environment variables in a parent shell in UNIX: Let us say you have a program named "bob" that wants to set environment variables. Under sh you would write a function like dave() { eval `bob` ; } Under ksh or csh, you would use an alias. The bob program then generates output that looks like VAR=VALUE VAR2=VALUE2 ... for sh or ksh, and some bizarro-nonsense format that may or may not have an "=" sign in it for csh. You then use "dave" instead of "bob" to set the variables. "bob" in effect generates commands for the shell, and "dave" causes the shell to execute them. -- Alan M. Carroll "It's psychosomatic. You need a lobotomy, Epoch Development Team I'll get a saw." CS Grad / U of Ill @ Urbana ...{ucbvax,pur-ee,convex}!cs.uiuc.edu!carroll