![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automating Autosys | LilyClaro | UNIX for Advanced & Expert Users | 0 | 03-23-2007 01:15 PM |
| Automating telnet and ftp | sendhilmani123 | Shell Programming and Scripting | 2 | 04-25-2006 05:37 AM |
| Automating sendmail | JimJim | Shell Programming and Scripting | 3 | 11-30-2004 06:31 AM |
| automating password ? | Liamo | Shell Programming and Scripting | 3 | 05-24-2004 06:01 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
displaying error while automating ftp
#!/bin/sh
HOST=HOST_IP USER=$USER PASSWD=$PASSWD FILE="*.htm" ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS $PASSWD get $FILE quit END_SCRIPT exit 0 Is there any way to display appropriate error message if the file is not found on the server...... |
|
||||
|
With verbose on 550 is the error returned for a file not found:
Code:
HOST=HOST_IP
USER=$USER
PASSWD=$PASSWD
FILE="*.htm"
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
verbose
get $FILE
quit
END_SCRIPT | grep -q "550 $FILE"
if [[ $? -eq 0 ]] ; then
echo "$FILE not found"
fi
exit 0
|
|
||||
|
Quote:
After trying the above code it didn't work. I hope, is there any method to trap the error codes in a variable...? please modify the code with the above code with the suggestion. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|