Re: what is the difference?
From: scriptOmatic (ScriptOmatic_at_ChironComputing.Com)
Date: 04/29/03
- Next message: Saurabh Verma: "'!#' script interpreter convention ..."
- Previous message: Shawn: "what is the difference?"
- In reply to: Shawn: "what is the difference?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 29 Apr 2003 00:13:15 GMT
Shawn wrote:
>
> Hi,
>
> Could somebody tell me what the difference between these 2 scripts are?
>
> if $status then
> echo "File transfer from cs-vulcan failed"
> exit 1
> endif
>
> ##########
>
> if ($status != 0) then
> echo "File transfer from cs-vulcan failed"
> exit 1
> endif
>
> Thanks!
I assume you are in /bin/csh or /bin/tcsh because these shells
define $status to the the value of the last command executed.
With UNIX, if the last command exited 0 then, of course,
$status == 0 is TRUE.
With UNIX if a command exits with 0 that means SUCCESS and any
value not zero means failure. While this is not strictly true,
because any programmer can intentially break the rule,
it is non-theless true for utilities. Note however, if you
are using an FTP client, many of them do not play by the rules.
YOu can see the NCFTP client and/or you might look at OSM which
includes a file transfer plugin to do what you want above.
Back to the scripts ....
if $status then
...
would mean
if 0 then
echo failure
and that should be WRONG
but the second script
if ($status != 0) then
echo failure
is correct (again assuming the copy command plays by the rules).
You might also try, for remote copies, rcp and/or scp.
FYI the OSM implementation allows you to use anonymous and/or passworded
transfers.
-- http://ftp.opensysmon.com is a shell script archive site with an open source system monitoring and network monitoring software package. Many platforms are supplied already compiled.
- Next message: Saurabh Verma: "'!#' script interpreter convention ..."
- Previous message: Shawn: "what is the difference?"
- In reply to: Shawn: "what is the difference?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|