Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

could we use $? with ftp

Status
Not open for further replies.

cantubas

Programmer
Jan 8, 2004
45
FR
when I'm doing
ftp -in 192.168.xx.xx <<END
user $userString $pswdString
binary
send $1
bye
END
how can i know if some command of my script "ftp" isn't succesfull by example:
$userString is false
$1 don't be sent
etc...

escuse me for my bad english, I'm french
 
This thread thread822-623899 may help you

Jean Pierre.
 
for a list of FTP numeric codes look at FTP codes

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Capture the output from ftp and grep for success...

ftp -inv 192.168.xx.xx <<END >ftplog 2>errorlog
user $userString $pswdString
binary
send $1
bye
END

if grep -q ^226 ftplog
then
echo Info: file $1 sent okay
else
echo Error: file $1 not sent
echo Reason: `cat errorlog`
fi
 
ftp -inv 192.168.xx.xx <<END >ftplog 2>errorlog
user $userString $pswdString
binary
get $1
del $1
bye
END


I want to delete $1 if the "get" is OK. I have to do 2 scripts:
one for the get then i'm testing if $1 is on my computer
an other script for delete $1 ???????????????????

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top