Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unset VAR

Status
Not open for further replies.

unixkid

IS-IT--Management
May 22, 2001
105
US
Have some application scripts that appear to be hung up on VARS. Five scripts run and each set VARs but I would like to know if there is a command to unset all VARs before running thr next script (starting with a clean plate so to speak..) I'm running a ksh shell
 
If you run your scripts in separate shells, you should not have that problem.
Else, what you may do is set the variable but not export it.
 
yes each VAR is set in diffrent scripts but it seems after the scripts have been run the previous VARs stay set
 
Then it means you are exporting the VAR. If you do not want the VAR to stay in your environment, dont export VAR in your script.
 
You could use a wrapper with a set minimal of variables defined.

e.g

#!/bin/sh
./environment
# where environment is a list of VARS to be exported
./rest_of_script
# where rest_of_script is your original script with no environment or shell stuff in it what so ever.

Use this kind of thing a lot when using cron Ian

"IF" is not a word it's a way of life
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top