Hi Folks,
I know that thgis is a basicly problem and I feel ashamed because I've been searching 2 weeks for the missing point.
I write a shellscript in whch I tried to set variables and want to use this variables in this window. The script works fine inside the script, as I see on the printings, but if this script is over and I asked about env - the variables are not changed.
We're using HP-UX 11.0
The case-tabs are included in the oratab and the grep works fine and correct.
Below's the script:
#########################################################
#!/bin/ksh
DB=$(cat /etc/oratab | grep -v "#" | grep -v '^$' | grep -v "*" | awk -F: '{print $1}')
print "\n\n\nFolgende Datenbanken stehen zur Auswahl\n "$DB
print "\Which DB' ?? "
read inp
case $inp in
ADSYS)
export ORACLE_HOME=/ora1/app/oracle/product/8.0.4
export ORACLE_SID="${inp}"
env | grep ORA
print "\nYou choose " $ORACLE_SID
;;
ASBKP )
ORACLE_HOME=/ora1/app/oracle/product/8.0.4/
ORACLE_SID=$inp
export ORACLE_HOME ORACLE_SID
print "\nYou choose" $ORACLE_SID;;
* ) print "Anything wrong";;
esac
echo "\n\n" $ORACLE_SID
########################################################
The prints inside and outside works fine, both replied the choosen variables, but If I send a new script like env | grep ORA the Variables values the old entries and not the changed.
I know that thgis is a basicly problem and I feel ashamed because I've been searching 2 weeks for the missing point.
I write a shellscript in whch I tried to set variables and want to use this variables in this window. The script works fine inside the script, as I see on the printings, but if this script is over and I asked about env - the variables are not changed.
We're using HP-UX 11.0
The case-tabs are included in the oratab and the grep works fine and correct.
Below's the script:
#########################################################
#!/bin/ksh
DB=$(cat /etc/oratab | grep -v "#" | grep -v '^$' | grep -v "*" | awk -F: '{print $1}')
print "\n\n\nFolgende Datenbanken stehen zur Auswahl\n "$DB
print "\Which DB' ?? "
read inp
case $inp in
ADSYS)
export ORACLE_HOME=/ora1/app/oracle/product/8.0.4
export ORACLE_SID="${inp}"
env | grep ORA
print "\nYou choose " $ORACLE_SID
;;
ASBKP )
ORACLE_HOME=/ora1/app/oracle/product/8.0.4/
ORACLE_SID=$inp
export ORACLE_HOME ORACLE_SID
print "\nYou choose" $ORACLE_SID;;
* ) print "Anything wrong";;
esac
echo "\n\n" $ORACLE_SID
########################################################
The prints inside and outside works fine, both replied the choosen variables, but If I send a new script like env | grep ORA the Variables values the old entries and not the changed.