Ok, I have a script I use for passing a username/password to log into Oracle. The same method should be able to be used for what you are attempting. I have not tried it, give me some time, and I will try it for you.
First script you would call is get_pw. get_pw calls variable pwfile. pwfile gives the path to a file named do_not_delete which contains the username and password you want to pass in the script. To ensure security, the file do_not_delete is compressed, and renamed. Both files are also hidden.
Example 1: "get_pw"
#!/bin/sh
pwfile=${OPATH}/.do_not_delete
if [ -f $pwfile ]
then
host=$1
sid=$2
account=$3
passwd=`zcat <$pwfile| awk '$1=="'$host'" && $2=="'$sid'" && $3=="'$account'"{print $4}'`
if [ -z "$passwd" ]
then
echo "****Error*** No password found for specified parameters"
exit 1
else
echo $passwd
fi
else
echo "***Error*** You are not set up to use this utility"
exit 1
fi
Note in get_pw: The OPATH is not defined in this script. I am using this as an added level of safety. Since under normal circumstances, this script is called from another script which has set the OPATH variable. If someone with
priviledges runs this script directly, the absense of this variable will cause it to fail.
Example 2: do_not_delete
node sid id pw
hostname ORA1 username password