Hi,
on AIX 6.1
I have a shell script that calls another shell which have some parameters. Say like the following :
##This is main script############
myparameters.sh
command1
command2
.....
....
And here myparameteres.sh :
export ORACLE_SID=MYDB
export mydir='/appli/oracle/BACKUP/RMAN/INCR/$ORACLE_SID'
export user=rmanuser
The problem is that after comming back to the main script the parameteres have lost their values :
echo $ORACLE_SID
ANOTHERDB
How can I resolve this ??
Thank you.
In sh/ksh/bash... you 'source' your parameter file like so:
##This is main script############
. myparameters.sh
command1
command2
.....
....
1 Like
realy thank you.
I call myparameters.sh script :
. myparameters.sh abcd
And then in myparameters.sh, I set a parameter like this :
export mydir='/appli/oracle/BACKUP/RMAN/$1/$ORACLE_SID'
But the result is :
echo $mydir
/appli/oracle/BACKUP/RMAN/$1/$ORACLE_SID
ORACLE_SID is set (exported) in main script.
thanks for help.
export mydir="/appli/oracle/BACKUP/RMAN/$1/$ORACLE_SID"
Isn't $1 just the first parameter? You're not giving it any parameters when you source it, so $1 will be blank at best.