Re: question about setenv
- From: "EdStevens" <quetico_man@xxxxxxxxx>
- Date: 30 Oct 2006 05:53:33 -0800
Kaz Kylheku wrote:
So I do a find on setenv, locate the directory it is in and add it to
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
They /print/ output such as
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
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?
Not so obviously
You have not read one shred of documentation about it;
You assume much ....
something you found lying in some path somewhere.
No. It was something found in a script generated by a major, trusted
vendor. And from the context in which it was found, it's intended
function was rather obvious.
Have you even checked
whether it's a script or a binary executable?
Yes, I had. Sorry you just blindly assume that I hadn't.
What if someone wrote something called "setenv" which invokes "rm -rf
*"? You would just blindly run it, right?
What if someone wrote and installed something called "ls" which invokes
(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
Well, it's not as if they are a bunch of bumbling boobs. The man page
does document that 'setenv' is native to some shells, so I can see
where it would be easy enough for the guy who wrote the script genning
routing to miss that it isn't universal.
- Prev by Date: Re: Question re: braces and quotes
- Next by Date: Re: manipulating PS1 in sh
- Previous by thread: Re: question about setenv
- Next by thread: Re: question about setenv