Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Shell script commands NOT executing!!

Posted on 2004-10-20
3
Medium Priority
?
540 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 200 total points
ID: 12364521
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
ID: 12364631
It worked after I fixed that error ("-EOF"...)!!!!

many Thanks!!!!
0
 
LVL 21

Expert Comment

by:tfewster
ID: 12364778
"<<-" 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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.
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

963 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