[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: is this a bashism?



Hi John,

On Mon, Dec 21, 1998 at 10:48:59PM -0600, john@dhh.gt.org wrote:

> A script consisting only of those two lines will return 1, and so it
> should.  It will do so for bash or ash.  It would do so for the Bourne
> shell.

 Ok. This is the shortest script that exhibits this:

 #! /bin/sh

 set -e

 case "$1" in
   remove)
     [ -x /bin/does-not-exist ] && does-not-exist
   ;;
 esac

 exit 0

 [9 jacinta:~] /bin/ash -xe ./wmmail.postrm remove ; echo $?
 + set -e
 + [ -x /bin/does-not-exist ]
 1

 [10 jacinta:~] /bin/bash -xe ./wmmail.postrm remove ; echo $?
 + set -e
 + '['-x /bin/doesnotexist ']'
 + exit 0
 0

 This doesn't:

 #! /bin/sh

 set -e

 [ -x /bin/does-not-exist ] && does-not-exist

 exit 0

 my question is not how to solve this, but why this happens. Obviously
 I'm missing something important regarding how case works.


                                           Marcelo


Reply to: