Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jun 2001 16:43:07 +0200
From:      Stijn Hoop <stijn@win.tue.nl>
To:        Jim Freeze <jim@freeze.org>
Cc:        Alex Dyas <ADyas@twowaytv.com>, j mckitrick <jcm@FreeBSD-uk.eu.org>, freebsd-questions@freebsd.org
Subject:   Re: exporting TERM from a script
Message-ID:  <20010628164307.I4658@pcwin002.win.tue.nl>
In-Reply-To: <Pine.BSF.4.32.0106281030560.9354-100000@www.stelesys.com>; from jim@freeze.org on Thu, Jun 28, 2001 at 10:33:01AM -0400
References:  <911D8F660DF6D411B61F00500462BA01B08470@exchange.twowaytv.co.uk> <Pine.BSF.4.32.0106281030560.9354-100000@www.stelesys.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 28, 2001 at 10:33:01AM -0400, Jim Freeze wrote:
> On Thu, 28 Jun 2001, Alex Dyas wrote:
> >
> > Try running the script thus:
> >
> > $ . ./gonet
> >
> Hmmm, I get
> 
> $ . ./myscript.sh
> .: Permission denied.
> 
> Where as
> $ ./myscript.sh
> 
> runs fine, just no changing of the parents env.

Works here:

$ echo $TEST

$ ls -l bla.sh
-rw-r--r--  1 stijn  stijn  32 Jun 28 16:39 bla.sh
$ cat bla.sh
TEST=test; export TEST
echo dsa
$ . bla.sh
dsa
$ echo $TEST
test

but only in sh - use 'source' for csh/tcsh (and make sure your
script is written in the syntax for those shells!)

As to why this works, that's because this command executes all
commands listed in the file as if you had typed them in; that
is, it doesn't spawn a subshell. So, you modify your login shell's
environment (which is what you wanted).

Thank you Alex for the suggestion - I didn't think of it before.

--Stijn

-- 
Tact, n.:
	The unsaid part of what you're thinking.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010628164307.I4658>