From owner-freebsd-questions Fri Jun 29 0:53: 0 2001 Delivered-To: freebsd-questions@freebsd.org Received: from saturn.cs.uml.edu (saturn.cs.uml.edu [129.63.8.2]) by hub.freebsd.org (Postfix) with ESMTP id DFFCD37B403 for ; Fri, 29 Jun 2001 00:52:57 -0700 (PDT) (envelope-from acahalan@saturn.cs.uml.edu) Received: (from acahalan@localhost) by saturn.cs.uml.edu (8.11.0/8.11.2) id f5T7ql2453217; Fri, 29 Jun 2001 03:52:47 -0400 (EDT) Date: Fri, 29 Jun 2001 03:52:47 -0400 (EDT) Message-Id: <200106290752.f5T7ql2453217@saturn.cs.uml.edu> From: "Albert D. Cahalan" To: jim@freeze.org Cc: questions@freebsd.org Subject: Re: How to have a script set an environment variable Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Jim Freeze writes: > I don't know if this can be done, but I am would like > to write a script that would set an environment variable > for a particular terminal window. > > I am running tcsh. If I write a script such as: > #! /bin/sh > set TEST "test" > export TEST > > TEST is set for the script, but not for the parent > terminal. Is there a switch I can send to /bin/sh > to use the parent's environment? If you want to do this the fun way... 1. Get the PID of the shell in that "particular terminal window". (use "ps" and your choice of awk, perl, sed, etc.) Plain $$ will do if "particular terminal window" is the same place you run the script. 2. Run the debugger, feeding it commands that... 3. attach to the shell by the PID above 4. change the environment, including any app-specific cache 5. quit To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message