1846732 Members
4460 Online
110256 Solutions
New Discussion

scripting

 
SOLVED
Go to solution
Troyan Krastev
Regular Advisor

scripting

Hi all,

I attach a script that download an Oracle utility. Download is ok, but the loop after the FTP session doesn't work! If the loop is before the FTP session, it is ok! Any explanation?

Thanks,
Troy.
7 REPLIES 7
Mark Greene_1
Honored Contributor

Re: scripting

for I in 1 2 2 3
do
echo "<${I}>"
done

As coded, this is looking for files named "1", "2", and "3" that are, presumably executeable.

HTH
mark
the future will be a lot like now, only later
Bill McNAMARA_1
Honored Contributor

Re: scripting

This is what I get from that loop...

manaus :/ # ./file
<1>
<2>
<2>
<3>

in either case, supply the set -x output for a quicker investigation..

Later,
Bill
It works for me (tm)
Troyan Krastev
Regular Advisor

Re: scripting

Hi Mark,

Remove the FTP session and run the script again. Without FTP I get:
linus:/tmp/tr #./patchsetlogs
+ PATCHSET_FTP=oracle-ftp.oracle.com
+ PATCHSET_UTIL=patchsets.sh
+ PATCHSET_DIR=apps/patchsets/PATCHSET_COMPARE_TOOL
+ PATCHSET_USER=anonymous
+ PATCHSET_PASS=troyan.krastev@ricoh-usa.com
+ + basename ./patchsetlogs
WORK_DIR=/tmp/patchsetlogs
+ INST_DIR=/cpapps
+ [ ! -d /tmp/patchsetlogs ]
+ cd /tmp/patchsetlogs
+ chmod 777 /tmp/patchsetlogs/patchsets.sh
+ echo <1>
<1>
+ echo <2>
<2>
+ echo <2>
<2>
+ echo <3>
<3>
Wich is wat I expect with FTP too.

Troy
Troyan Krastev
Regular Advisor

Re: scripting

This is wat I get with FTP:
linus:/tmp/tr #./patchsetlogs
+ PATCHSET_FTP=oracle-ftp.oracle.com
+ PATCHSET_UTIL=patchsets.sh
+ PATCHSET_DIR=apps/patchsets/PATCHSET_COMPARE_TOOL
+ PATCHSET_USER=anonymous
+ PATCHSET_PASS=troyan.krastev@ricoh-usa.com
+ + basename ./patchsetlogs
WORK_DIR=/tmp/patchsetlogs
+ INST_DIR=/cpapps
+ [ ! -d /tmp/patchsetlogs ]
+ [ ! -d /tmp/patchsetlogs ]
+ cd /tmp/patchsetlogs
+ ftp -i -n
+ 0<<
open oracle-ftp.oracle.com
user anonymous troyan.krastev@ricoh-usa.com
passive
cd apps/patchsets/PATCHSET_COMPARE_TOOL
get patchsets.sh
close
bye
EOF

# make the utility executable
chmod 777 /tmp/patchsetlogs/patchsets.sh


# run the utility against every Instance
for I in 1 2 2 3
do
echo "<>"
done
Passive mode on.
linus:/tmp/tr #

Troy.
Bill McNAMARA_1
Honored Contributor
Solution

Re: scripting

try changing EOF to ENDOFFTP

Bill
It works for me (tm)
Troyan Krastev
Regular Advisor

Re: scripting

Thanks Bill. Can you explain.

Troy.

Zafar A. Mohammed_1
Trusted Contributor

Re: scripting

Most of the time it happens in "for" loop when you are using EOF. So, always try to use some other different EOFFTP instead of EOF.

Thanks
Zafar