Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jun 2001 01:32:17 -0500
From:      Mike Meyer <mwm@mired.org>
To:        Jim Freeze <jim@freeze.org>
Cc:        questions@freebsd.org
Subject:   RE: exporting TERM from a script
Message-ID:  <15164.8433.760308.623729@guru.mired.org>
In-Reply-To: <75835077@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
Jim Freeze <jim@freeze.org> types:
> On Thu, 28 Jun 2001, Alex Dyas 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.
> > ah, could be a ksh thing in that case. what shell are you doing this in?
> It doesn't work from tcsh on Solaris.

tcsh uses csh syntax: "source myscript.csh". 

This will quickly point out one of the other differences between
executing a script and sourcing it. If you execute it, what shell
you're using doesn't matter. If you source it, it's read by the shell
you're using, so the script must use commands valid for that
shell. For example, tcsh will use "setenv" instead of "export" to
export variables to the environment.

> It does work from bash on FreBSD.

Since it's supposed to be compatable with sh, that's not
surprising. Since it supports a lot of csh syntax as well, that
"source" also works is unremarkable. I'm not sure what to make of
"setenv" not working in bash, though.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

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?15164.8433.760308.623729>