bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] tests/test-xalloc-die.sh: Use $EXEEXT.


From: Eric Blake
Subject: Re: [PATCH] tests/test-xalloc-die.sh: Use $EXEEXT.
Date: Sat, 13 Feb 2010 08:05:10 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

According to Jim Meyering on 2/13/2010 7:55 AM:
>> For negated character classes in shell case statements, POSIX says to use
>> [!a-z], not [^a-z].
> 
> I've made that change, too.
> Does it matter in practice?

It matters for at least Solaris /bin/sh.

$ /bin/sh -c 'case a in [^b]) echo yes;; *) echo no;; esac'
/bin/sh: syntax error at line 1: `^' unexpected
$ /bin/sh -c 'case a in [!b]) echo yes;; *) echo no;; esac'
yes

But that particular example is a moot point, given the use of $().

> That's certainly more efficient.
> Since it's less readable to me, I've added a comment.

Indeed.  And it still needs a tweak:

> +      *) # Remove leading file name components as well as the .exe suffix.
> +         feb_file_=${${feb_file_##*/}%.exe}
>        feb_result_="$feb_result_$feb_sp_$feb_file_";;

Won't work as written, the % operator only works on variable names, but
${feb_file_##*/} is not a variable name.  Instead, you need an
intermediate store:

feb_file_=${feb_file_%.exe}
feb_file_=${feb_file_##*/}

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]