whoopwhoop2015
asked on
How to pass variables from shell script to sqlplus
How can I pass in newValue to sqlplus from shell? It keeps erroring out due to $1 and like characters which are a random value assigned to newValue in database.
newValue= $2a$10$1Qect
newValue= $2a$10$1Qect
#!/bin/ksh
common_pass=password
for db_user in db1/user1 db2/user2 db3/user3 db4/user4 db5/user5 db6/user6
do
db=`echo $db_user | cut -f1 -d/`
user=`echo $db_user | cut -f2 -d/`
$ORACLE_HOME/bin/sqlplus ${user}/${common_pass}@${db} << EOF
select * from tab
where idValue = $newValue;
EOF
done
newValue='$2a$10$1Qect'
ASKER
I tried adding newValue='$2a$10$1Qect' under common_pass=password and it gives me a missing expression error pointing to the first dollar sign.
try to add \ before $
ASKER
I have tried newValue='\$2a$10$1Qect' and I get invalid character where idValue = \$2a$10$1Qect
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you ozo.
newValue='$2a$10$1Qect'
where idValue = '$newValue';
newValue='$2a$10$1Qect'
where idValue = '$newValue';