Re: question about setenv
Kaz Kylheku wrote:
> 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
> 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?
Possibly
>
> 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 ....
>it's just
> 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
"rm -rf"?
>
> > (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.
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.
|