1755680 Members
5340 Online
108837 Solutions
New Discussion

Re: scripts

 
System Dude_1
Frequent Advisor

scripts

Could anyone solve this problem of mine :
Script a will call script b. One script b completed it should continue with the next command in script a but failed :

Script A

#!/bin/ksh

. /opt/home/scripts/profile

EXE=/opt/home/scripts
LOG=/opt/home/log

cd $LOG
rm -f test.lst
rm -f extract_test.log
rm -f ftp.dat

passwd=`cat /opt/home/.passwd`
sqlplus /nolog << ESQL
connect test/$passwd@TEST
@$EXE/test.sql <EOF
ftpToserver()
{
echo "user usera usera" > $LOG/ftp.dat
echo "lcd /opt/home/log" >> $LOG/ftp.dat
echo "cd /opt/home/test/tables/TEST" >> $LOG/ftp.dat
echo "put test.lst" >> $LOG/ftp.dat
echo "bye" >> $LOG/ftp.dat
ftp -n -i 191.191.191.191 < $LOG/ftp.dat
}

ftpToserver

Script B(test.sql)
set feedback off
set heading off
set pages 0
set lines 26

spool /opt/home/log/test.lst

select * from test;

spool off
exit
Performance Issue on HP-UX 10.20
1 REPLY 1
Wodisch
Honored Contributor

Re: scripts

Hi "system dude",

first the tag "ESQL" is missing in script "A".
And second, I am quite certain that you cannot nest "here documents" (input re-diretion with "<...and it isn't even neccessary in your scripts...

passwd=`cat /opt/home/.passwd`
sqlplus /nolog << ESQL
connect test/$passwd@TEST
echo "" | @$EXE/test.sql
ESQL

Oh, and even the 'echo "" |' isn't neccessary - I did simply include it to emphasize on how to replace the "inner" here-document...

HTH,
Wodisch