[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature request: more complete set -e
From: |
Greg Wooledge |
Subject: |
Re: feature request: more complete set -e |
Date: |
Tue, 30 Jun 2009 16:06:46 -0400 |
User-agent: |
Mutt/1.4.2.2i |
On Tue, Jun 30, 2009 at 09:58:45PM +0200, Marc Weber wrote:
> How is this done?
>
> CHK0="test $? == 0"
> my_important_task; $CHK0 || exit 1
You'd need single quotes instead of double there. (And == is illegal in
Bourne/POSIX shell test commands; only bash tolerates it.) You could
also use a function instead:
check() { test $? = 0; }
my_task; check || exit 1
Or, you could avoid the extra definition and simply check directly:
my_task || exit 1
my_task || { echo "error occurred" 1>&2; exit 1; }
- feature request: more complete set -e, Marc Weber, 2009/06/22
- Re: feature request: more complete set -e, Chet Ramey, 2009/06/23
- Re: feature request: more complete set -e, Marc Weber, 2009/06/24
- Re: feature request: more complete set -e, Chet Ramey, 2009/06/25
- Re: feature request: more complete set -e, Marc Weber, 2009/06/28
- Re: feature request: more complete set -e, Greg Wooledge, 2009/06/29
- Re: feature request: more complete set -e, Chet Ramey, 2009/06/29
- Re: feature request: more complete set -e, Bob Proulx, 2009/06/29
- Re: feature request: more complete set -e, Marc Weber, 2009/06/30
- Re: feature request: more complete set -e,
Greg Wooledge <=
- Re: feature request: more complete set -e, Chet Ramey, 2009/06/30