Solved

Shell script commands NOT executing!!

Posted on 2004-10-20
3
525 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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AIX Server 10 91
ftpcommand 2 74
Linux hostname change 2 89
Showing a username in UNIX and using that name in the script 4 59
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

726 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