The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-31-2006
bishweshwar bishweshwar is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 56
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......
  #2 (permalink)  
Old 11-01-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,754
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
  #3 (permalink)  
Old 11-02-2006
bishweshwar bishweshwar is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 56
Quote:
Originally Posted by jim mcnamara
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

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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0