Hi,
I want to write the shell script to change multple file name (the file name is get from DB)
e.g.
cp db1.txt file1_new.txt
cp db2.txt file2_new.txt
cp db3.txt file3_new.txt
I have write the script like this:
VAR=`sqlplus -s $LOGON @<<ENDOFTEXT
set termout off
set feedback off
set pagesize 0
select 'cp '||file_name||' new'||file_name from table;
exit
ENDOFTEXT `
echo $VAR
for p in $VAR
do
echo " command=[$p]"
done
the result is
command=cp
command=db1.txt
command=file1_new.txt
......
How can I get the expected result and run it, like this
command=cp db1.txt file1_new.txt
command=cp db2.txt file2_new.txt
Thank you very much!!!