Date: Thu, 07 May 2009 12:09:05 +0530 From: "N. Raghavendra" <raghu@mri.ernet.in> To: Eddie Chen <echen@nyx.com> Cc: freebsd-questions@freebsd.org Subject: Re: ReturnCode Checking for FTP Message-ID: <86hbzxmn7a.fsf@riemann.mri.ernet.in> In-Reply-To: <OFC2C1BBE0.21B6D28C-ON852575AE.0054A36E-852575AE.00567F9E@nyx.com> (Eddie Chen's message of "Wed, 6 May 2009 11:44:46 -0400") References: <OFC2C1BBE0.21B6D28C-ON852575AE.0054A36E-852575AE.00567F9E@nyx.com>
next in thread | previous in thread | raw e-mail | index | archive | help
At 2009-05-06T11:44:46-04:00, Eddie Chen wrote: > Reading the ftp commands seems to be better, because it will exit(rc) > if any of "put" or "rename" failed. Perhaps you've already looked at `lftp', http://lftp.yar.ru/ Exit codes of its commands can be used from the shell, e.g., as follows: % set SERVER="ftp://ftp.freebsd.org/pub/FreeBSD/" % lftp -c "open -e 'cat README.TXT' ${SERVER}" > /dev/null && echo "OK" OK % lftp -c "open -e 'cat NOEXIST' ${SERVER}" || echo "FAILED" FAILED Further, lftp commands themselves can use the exit codes of previous commands: % lftp -c "open -e 'ls foo && ls misc' ${SERVER}" ls: Access failed: 404 Not Found (foo) % lftp -c "open -e 'ls foo || ls misc' ${SERVER}" ls: Access failed: 404 Not Found (foo) drwxr-xr-x -- ~ drwxr-xr-x -- ~/pub drwxr-xr-x -- .. drwxr-xr-x -- . drwxr-xr-x - 2007-11-02 00:00 fbsd-compat -rw-r--r-- 1k 2002-04-03 00:00 supfile HTH, Raghavendra. -- N. Raghavendra <raghu@mri.ernet.in> | http://www.retrotexts.net/ Harish-Chandra Research Institute | http://www.mri.ernet.in/ See message headers for contact and OpenPGP information.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86hbzxmn7a.fsf>