ksh(korn shell) - list of environment (115 Views)
Reply
Regular Advisor
Billa-User
Posts: 159
Registered: ‎02-16-2004
Message 1 of 8 (115 Views)

ksh(korn shell) - list of environment

hello,

with the command "set" i can set serveral options like "set -x, set -a" and so on.
i have a difficult application and i want
to debug some steps. i want to know , which
options are used by "set". with command "env" , i can't see the settings. for example, in ORACLE-SQLPLUS , i can use the command "show all" and i can see the settings.

best regards

tom
Please use plain text.
Honored Contributor
Muthukumar_5
Posts: 4,030
Registered: ‎06-09-2004
Message 2 of 8 (115 Views)

Re: ksh(korn shell) - list of environment

To get shell environement use like,

# env
# typeset
# set

read man ksh page.

--
Muthu
Easy to suggest when don't know about the problem!
Please use plain text.
Honored Contributor
Arunvijai_4
Posts: 4,194
Registered: ‎04-07-2005
Message 3 of 8 (115 Views)

Re: ksh(korn shell) - list of environment

Hi,

Do a # man sh-posix and man ksh, you will find everything there.

_Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Please use plain text.
Honored Contributor
V. Nyga
Posts: 4,874
Registered: ‎09-20-2002
Message 4 of 8 (115 Views)

Re: ksh(korn shell) - list of environment

Hi,

when you set environments in an application you can display them with
'echo $'
Put it in your program to check the current settings of the variable .

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Please use plain text.
Trusted Contributor
Antonio Cardoso_1
Posts: 244
Registered: ‎10-21-2002
Message 5 of 8 (115 Views)

Re: ksh(korn shell) - list of environment

Hi tom,

just type "set" alone, it will display all currently set variables.

Addition stuff on shell programming in "Shells: User's Guide: HP 9000 Computers"
http://docs.hp.com/en/B2355-90046/

part III is for ksh.

antonio.
Please use plain text.
Honored Contributor
Peter Nikitka
Posts: 1,575
Registered: ‎02-10-2003
Message 6 of 8 (115 Views)

Re: ksh(korn shell) - list of environment

Hi,

if you mean the value of options you have set with the set-command: Try
print $-
The variable '-' collect all the 'set'-flags, so:
set -x
set -e
print $-
ivx
(i -> interactive shell)

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Please use plain text.
Honored Contributor
Bill Hassell
Posts: 14,178
Registered: ‎05-29-2000
Message 7 of 8 (115 Views)

Re: ksh(korn shell) - list of environment

There are two environments for POSIX shells, locally defined variables and exported variables. To see the local variable, just type:

set

To see the exported variable which will be passed onto a script or process, tpye the command:

env

Since set is for the local environment, things like set -x will not apply to a script that you run normally. To trace a script, you can eithee run it with the -x option as in:

sh -x ./myscript

or add set -x to the beginning of your script. Note that in a script, functions are like new scripts so they don't inherit the -x option, so you'll have to add it to your functions.

Note that all the flags for set options are found in the variable $- where if the option has been set, the letter appears and if not set, the letter is missing. So,

echo $-
inum

means set -i -n -u and -m are all set and all others are reset.
Please use plain text.
Regular Advisor
Billa-User
Posts: 159
Registered: ‎02-16-2004
Message 8 of 8 (115 Views)

Re: ksh(korn shell) - list of environment

thank you for the helpful information's
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation