Solved

Shell script commands NOT executing!!

Posted on 2004-10-20
3
492 Views
Last Modified: 2010-04-21
This is my exact script:
The scipt ignore the part of the script after the FTP function. The echo statements never execute. Those echo parts work when I get rid of the upper FTP parts..
What's wrong??
====================
#!/bin/sh
cd /tmp
/bin/ftp -nv 190.1.100.100 << -EOF
user test1 abc123
hash
get test_file.txt
close
EOF

ret=`/usr/bin/diff /tmp/test_file.txt /export/usr1/test_file.txt`
echo "it is not going to output!!!!!!!!!!"
if [ $? -ne 0 ] ; then
echo "something!!!"
fi
=====================
0
Comment
Question by:tooki
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 50 total points
Comment Utility
I think that:

/bin/ftp -nv 190.1.100.100 << -EOF

needs to be:

/bin/ftp -nv 190.1.100.100 <<EOF

As written the script is looking for -EOF and you have EOF as the end marker.
0
 

Author Comment

by:tooki
Comment Utility
It worked after I fixed that error ("-EOF"...)!!!!

many Thanks!!!!
0
 
LVL 20

Expert Comment

by:tfewster
Comment Utility
"<<-" strips leading <TAB>s off the "here" document, so you can have your script prettily indented, e.g.

... <<-  EOF    
<TAB> input
<TAB>       <TAB>more input
<TAB>  EOF


But it often causes confusion, so you're better off without it ;-)

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
IBM flash storage 840 15 50
reinstall 1 55
aix tls version 6 150
bash while loop reading input from data section in script 7 30
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now