![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| xx=`date +"%a %b %d"`;rsh xxx grep "^$XX" zzz ? | Browser_ice | AIX | 2 | 06-13-2009 09:39 AM |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 03:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| grep to find content in between curly braces, "{" and "}," | keshav_rk | Shell Programming and Scripting | 4 | 08-09-2007 11:14 PM |
| No utpmx entry: you must exec "login" from lowest level "shell" | peterpan | UNIX for Dummies Questions & Answers | 0 | 01-18-2006 04:15 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
grep "226 Transfer complete" | wc -l
echo $ftp_ctr returns '0' instead of '1'. Please help
Code:
331 Enter password 230 User logged in 200 Transfer mode set to BINARY local: file1 remote: file2 227 Entering Passive Mode (xxxxxxxx). 125 Uploading in BINARY file xxx 226 Transfer completed 24453780 bytes sent in 67 seconds (3.6e+02 Kbytes/s) 221 bye 0 Code:
# Upload to ftp ################################################### ftp -v -n $HOST <<EOF quote user $FTPUSER quote pass $PASSWD cd "/name1/name2" bin put $FILEIN $FILEOUT EOF # Check the ftp status and file # ## wc -l tells the number of lines (accounts) ################################################### ftp_ctr=`ftp<<EOF| grep "226 Transfer complete" | wc -l EOF ` echo $ftp_ctr Last edited by vgersh99; 07-20-2009 at 05:58 PM.. Reason: code tags, PLEASE! |
|
||||
|
I'm unsure what you are doing in your wc statement with the ftp command, but I always redirect the ftp to a log and then grep from that log.
Code:
ftp -pnv > /tmp/ftp.log <<-EOF ... EOF CHECKERR=`cat /tmp/ftp.log | grep 226 | wc -l` |
|
||||
|
Quote:
![]() |
|
||||
|
cannot use ftp -pvn
here is the message : Code:
ftp: p: unknown option Usage: ftp [-v] [-d] [-i] [-n] [-g] [-k realm] [-f] [-x] [-u] [-t] [host] Last edited by vgersh99; 07-20-2009 at 05:59 PM.. Reason: code tags, PLEASE! |
|
||||
|
Use your orginal ftp statement, mine was just a example, but just add the redirect before the <<EOF in your just like I did in mine.
|
|
||||
|
Quote:
CHECKERR=`grep -c 226 /tmp/ftp.log` This works ?? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|