[EMAIL PROTECTED] wrote:
Script:
#! /bin/bash
set -e
archive_item()
{
set -e
false # this is the command that fails to archive the item
echo 'Archived.'
}
delete_item()
{
true # this is the command that deletes the item
echo 'Deleted!'
}
archive_item && delete_item
Expected output:
<empty>
Actual output:
Archived.
Deleted!
The right way to do this IMO is to forget 'set -e' and do:
archive_item()
{
set -e
if false # command that fails to archive the item
then echo 'Archived.'
else return $?
fi
}
...which causes 'archive_item' to return non-zero, so that '&&
delete_item' is never executed.
--
Matthew
find / -user your -name base -print0 | xargs -0 chown us:us
_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash