Re: question about setenv
- From: "Kaz Kylheku" <kkylheku@xxxxxxxxx>
- Date: 27 Oct 2006 11:24:08 -0700
EdStevens wrote:
So I do a find on setenv, locate the directory it is in and add it to
my path.
It's not possible for environment variable setting to be implemented as
an external command. Such commands run in their own process. In Unix, a
child process cannot manipulate the environment of the parent process.
There do exist programs which set environment variables with the help
of eval.
They /print/ output such as
export FOO=BAR
and this printed output is evaluated using the shell. E.g:
eval $(echo "FOO=BAR")
echo prints "FOO=BAR" on standard output. The $(...) command
interpolates that output into the eval command line, and eval evaluates
it as a shell expression, causing BAR to be assigned to FOO.
ok, there is no directory /usr/estevens/pref but why is setenv trying
to write a file at all?
What else can it do? Being an external command, it cannot write to your
environment variables.
Why don't you ask whoever installed this thing? It was not even in your
regular path; you located it by running find. Maybe it was written by
some local user as a shortcut for permanently recording environment
variables in his profile.
setenv isn't a standard command that would be found in /bin or /usr/bin
on a Unix system.
And why would it try to write that file to a
directory that is not guaranteed to be there?
Maybe because there are some installation steps that have to be taken
when using that program?
The users of that program obviously do have that directory, right?
You have not read one shred of documentation about it; it's just
something you found lying in some path somewhere. Have you even checked
whether it's a script or a binary executable?
What if someone wrote something called "setenv" which invokes "rm -rf
*"? You would just blindly run it, right?
(Another anomoly, which I need to pose to the vendor (Oracle) is that
it appears from the man page that setenv is for csh, but not sh, yet
they gen a script which specifically runs sh and calls setenv.)
But don't worry, they are getting into the Linux distribution business,
which will teach them a thing or two, even if it's by way of
acquisition.
.
- Follow-Ups:
- Re: question about setenv
- From: EdStevens
- Re: question about setenv
- References:
- question about setenv
- From: EdStevens
- question about setenv
- Prev by Date: Re: scripting help
- Next by Date: Re: scripting help
- Previous by thread: Re: question about setenv
- Next by thread: Re: question about setenv
- Index(es):
Relevant Pages
|