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

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.

.



Relevant Pages

  • Re: A more structured approach
    ... I still find Gas fairly cryptic, but I haven't spent much time with it. ... If we started with no command line parameters, this would point at an environment variable, If we started with one or more command line parameters, this might point to one of them, or to the zero that separates command line args from environment variables. ... I suspect what you tried that *didn't* work was a memory to memory compare "cmpb, ...
    (alt.lang.asm)
  • Re: Failed running .bat file from WinXP Explorer
    ... If you use>> anything to the right will be echoed in the command prompt. ... typed in a Command or Run window. ... What does PATHEXT show? ... System environment variables are in the following Registry key: ...
    (microsoft.public.windowsxp.general)
  • RE: Windows environment variables
    ... For setting and removing environment variables from the command line, ... Modeled after the famous Black Hat event inL ... Symantec is the Diamond sponsor. ...
    (Security-Basics)
  • Re: question about setenv
    ... an external command. ... There do exist programs which set environment variables with the help ... Being an external command, ... on a Unix system. ...
    (comp.unix.shell)
  • Re: setting environment variables
    ... command. ... Please tell me how to set the environment variables through tcl-expect. ... setenv DISPLAY <my ipadd> ...
    (comp.lang.tcl)