Re: question about setenv
- From: "Hubble" <reiner@xxxxxxxxx>
- Date: 27 Oct 2006 06:51:02 -0700
EdStevens schrieb:
#!/bin/sh
-set x
setenv ORACLE_SID mysid
When running the script, the setenv line returns "setenv: not found"
setenv is a C-Shell builtin, not a Bourne Shell builtin. See "man sh"
and "man csh".
The corresponding sh command is "export". If you use csh as your login
shell, be aware of the (very) different syntax (you told your script
to use #!/bin/sh !)
ORACLE_SID=mysid
export ORACLE_SID
Note that "export" and "setenv" do not really setenv or export from a
sub shell
(script). If you use csh, either put setenv commands to .login or
..cshrc
and use "alias" if you want to set environment variables interactively
Put in .login
alias ods "setenv ORACLE_SID=mysid"
The you can use the "command" ods to set the environment.
If you put environment variables in a C-Shell script, you must (!)
source it:
#!/bin/csh
# -- script ods.csh
setenv SID 1
setenv X 2
The you must source this:
source ods.csh
You can also define an alias
alias ods="source ods.csh"
By the way: do not use C-Shell for serious scripts (using it as a login
shell is ok)
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
Hubble.
.
- References:
- question about setenv
- From: EdStevens
- question about setenv
- Prev by Date: Re: Server Size
- Next by Date: Re: question about setenv
- Previous by thread: question about setenv
- Next by thread: Re: question about setenv
- Index(es):
Relevant Pages
|