Solved

Shell script commands NOT executing!!

Posted on 2004-10-20
3
534 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 50 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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
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.

635 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