How to determine which Unix shell you are using:
> env | grep SHELL
-or-
> echo $SHELL
-or-
> ps -f ....Will provide a full listing of processes associated
with the current terminal, one of which will be the
shell process.
-or-
> setenv ....On a C shell this will return the current
environment, while other shells will return an error.
Please Note:
The following examples use 'ORACLE_HOME' as the variable name.
BOURNE SHELL(sh):
-----------------
To set environment variables within a Bourne Shell (sh), the variable must be
initialized locally, then exported globally:
> ORACLE_HOME=/u01/app/oracle/product/8.1.7
...defines ORACLE_HOME locally to the shell
> export ORACLE_HOME
...makes it globally available to other processes started from
this shell
To have a variable set automatically when you log into the Bourne Shell of your
Unix server:
Add the above lines (minus the '>' prompt) to the hidden '.profile'
file in your $HOME directory.
If you make changes to your '.profile' and want those changes propagated to
your current running environment (without having to log out, then back in):
> cd $HOME
> . .profile
To unset environment variables within a Bourne Shell (sh):
> unset ORACLE_HOME
To check what an environment variable is set to:
> env | grep ORACLE_HOME
KORN SHELL(ksh):
----------------
To set environment variables within a Korn Shell (ksh), you can use the Bourne
syntax show above, or use the streamlined Korn Shell syntax:
> export ORACLE_HOME=/u01/app/oracle/product/8.1.7
To have a variable set automatically when you log into the Korn Shell of your
Unix server:
Add the above lines (minus the '>' prompt) to the hidden '.profile'
file in your $HOME directory.
If you make changes to your '.profile' and want those changes propagated to
your current running environment (without having to log out, then back in):
> cd $HOME
> . .profile
To unset environment variables within a Korn Shell (ksh), use the same syntax
as you would in a Bourne Shell (sh):
> unset ORACLE_HOME
To check what an environment variable is set to:
> env | grep ORACLE_HOME
C SHELL(csh):
-------------
To set environment variables within a C Shell (csh):
> setenv ORACLE_HOME /u01/app/oracle/product/11.1.0
Wednesday, December 16, 2009
How to determine which Unix shell you are using
Posted by Bis at 1:29 PM 1 comments
Subscribe to:
Posts (Atom)