Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to stop csh script in even of error

1 view
Skip to first unread message

Fred Ma

unread,
Dec 1, 1997, 3:00:00 AM12/1/97
to

Hi,

I am executing a bunch of cascaded (pipelined) commands
in a subshell within a csh script. These pipelined commands
include tarring up stuff and gzipping the resulting
output stream. If there is a problem, such as a "disk
full" error, i would like the csh script to stop
rather than finish the rest of the script. Is there a
way to make this happen? The I searched the csh man pages
for the work "rror" (as in "Error" or "error"), but there
is no mention of how to do this. Please copy all replies
to this account. Thanks.

--
Fred Ma
f...@maxwell.uwaterloo.ca
--
Fred Ma
f...@maxwell.uwaterloo.ca

Moustafa Mounir Elqabbany

unread,
Dec 2, 1997, 3:00:00 AM12/2/97
to Fred Ma

If a properly-written command fails, it should set it's return value
to non-zero. In csh, you can test this by testing $status after you
run the command, or by running the command within the 'test' program.
(check 'man test') and testing for a non-zero value.

Cheers,
Moustafa

0 new messages