On 06/22/2012 04:28 PM, Stefano Lattarini wrote:

>>> -  # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
>>> -  me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.sh$//;s/\.tap$//'` \
>>> -    && test -n "$me" \
>>> -    || { echo "$argv0: failed to define \$me" >&2; exit 99; }
>>> +  # Strip all directory components.
>>> +  me=${argv0##*/}
>>
>> Should this strip to the last [\\/] instead of /?
>>
> Hrm, right.  But then, is something like '${argv0##*[\\/]`' actually portable
> to all decent shells?  Not sure.

Neither am I.  Everything after ## is supposed to be a glob, and [\\/]
is a glob, so I would assume so, but this is probably a corner case
likely to trip up assumptions.

> the user, *on MinGW/MSYS or Cygwin* manually invokes a test as, say,
> 
>   $ .\\t\\foo.sh

In which case, they deserve their longer error message.

> Of course, I'm ready to revisit this position if there will be real reports
> from real users/developers; until then, I'd keep the simpler idiom above.  OK?

Simpler is fine by me; I was just pointing out that you had a change in
behavior, and wondering whether it was intentional (answer is yes, it was).

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to