Quantcast
Channel: An error of variable type? - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 3

Answer by Stephen Kitt for An error of variable type?

$
0
0

As indicated in Shell : while read line nested, you can just do something like

(sed "s|^|@${SQL_HOME}/update_p.sql |" ${LST_HOME}/doc.lst; echo exit) | sqlplus64 ${UserCoribudg}/${PassCoribudg}@${ORACLE_SID}

If you want to run a command after every SQL update, you could loop, although there are a number of caveats (globbing etc.). If the values in your doc.lst are safe, you can do

while read line; do
    (echo @${SQL_HOME}/update_p.sql ${line}; echo exit) | sqlplus64 ${UserCoribudg}/${PassCoribudg}@${ORACLE_SID}
    /data/java_1.6_XX/bin/java -cp fr.bla.bla.bla
done < ${LST_HOME}/doc.lst

without needing to parse each line.

A safer option is to turn the whole file into a shell script:

sed "s|^|(echo @${SQL_HOME}/update_p.sql |" ${LST_HOME}/doc.lst | sed "s/$/; echo exit | sqlplus64/" | sed "s|$| ${UserCoribudg}/${PassCoribudg}@${ORACLE_SID}; /data/java_1.6_XX/bin/java -cp fr.bla.bla.bla|" > doc.script
sh doc.script

Viewing all articles
Browse latest Browse all 3

Trending Articles