Quoting Stewart Stremler <[EMAIL PROTECTED]>:
Presumably you're trying to do something seriously funky then?
Yeah, I think the 2 things I do the most that work find on bash, but either
don't work at all, or just don't do what I expect on sh are 1. math (i.e. I use
let var=num.. then later let var=$var+2 or something similar). Though I think
sh on linux does the math ok, but solaris doesn't (or didn't).
2. && and/or || several test things together on one line. Do things like:
if [ -f <somefile> ] && [ ! -d <somedir> ] ..etc
it would bitch on sh a lot, but bash worked fine.
Of course, both of these might be fine today, but I've been used to defaulting to bash for so long now.
Presumably it looked at $SHELL to generate the appropriate syntax?
Yeah, you can give a -b for bash/sh syntax or -c for *csh syntax to override that if it's in a script or something.
So it does what? Look at an environment variable, treat it as a path, and then prepends/removes/whatnot elements from that path, and then output something to set that variable to the adjusted value?
Pretty much. Helps with things like PATH by removing dupes.. too many users do
things like
setenv PATH /bin:/usr/bin...etc
then later in .cshrc:
setenv PATH ${PATH}:/bin:/usr/bin... etc
envmgr removes the dupes. Helps with things like LD_LIBRARY_PATH for cases
like:
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/new/path
when it wasn't set yet and the above would complain... users always forget to
check to see if a variable is set before doing something like the above.Even for something I might do, it cuts down on typing.
The above situation might be:
if ( $?LD_LIBRARY_PATH ) then
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:/new/path
else
setenv LD_LIBRARY_PATH /new/path
endifbut using envmgr it's just: eval `envmgr -a LD_LIBRARY_PATH /new/path`
A script implementation just sounds hairy. <shudder>
Heh.. I'd use perl myself. :)
How often is it really needed? I mean, it would be reallying annoying to read:
eval `envmgr -r foo bar`
instead of
foo=bar
Agreed.. I don't use it for simple 1 timer things. I use it for variables that
get used/changed several times in a file, or in scripts for variables that I
know the user has settings for.
Things like a wrapper we use for all programs being run on our sunray servers.
we want the apps to submit into lsf, so the programs (firefox, email client,
etc) run on application servers so the sunray server doesn't have to handle
that load (load on the sunray servers results in noticable performance issues
to all users on the server). When users log into the sunray server, we want to
make the path to the wrappers first in their paths... so we use:
eval `envmgr -bp PATH /path/to/wrappers`
and we know it's first, and it didn't change anything else in their PATH
setting. And it works for every shell in one line (it's a sh script so that's
why the -b in there).
-- Mike Marion-Unix SysAdmin/Staff Engineer-http://www.miguelito.org Marge: "Homer, sitting that close to the TV can't be good for you." Homer: "Talking while the TV's on can't be good for you!" ==> Simpsons
-- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
