[arch-projects] [devtools] [PATCH 2/3] when cleanup is called without code exit with 0
Ike Devolder
ike.devolder at gmail.com
Sat Feb 15 14:58:08 EST 2014
On Sat, Feb 15, 2014 at 01:12:41PM -0500, Dave Reisner wrote:
> On Sat, Feb 15, 2014 at 06:13:42PM +0100, BlackEagle wrote:
> > Signed-off-by: BlackEagle <ike.devolder at gmail.com>
> > ---
> > lib/common.sh | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/common.sh b/lib/common.sh
> > index 206ea01..3ca1c7e 100644
> > --- a/lib/common.sh
> > +++ b/lib/common.sh
> > @@ -65,7 +65,7 @@ setup_workdir() {
> >
> > cleanup() {
> > [[ -n $WORKDIR ]] && rm -rf "$WORKDIR"
> > - [[ $1 ]] && exit $1
> > + [[ ! -z $1 ]] && exit $1 || exit 0
>
> [[ ! -z $ 1 ]] is like using a double negative. it's exactly the same as
> the code you replaced. Why not just:
>
> exit ${1:-0}
>
ok that is indeed much simpler
--
Ike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mailman.archlinux.org/pipermail/arch-projects/attachments/20140215/691bde8a/attachment-0001.asc>
More information about the arch-projects
mailing list