On 05/16/2011 01:40 PM, Paul Eggert wrote:
> lswords=`ls -1diL "$src" "$dst" 2>/dev/null` &&
> inum= && \
> for lsword in $lswords; do
>   case $lsword in
>     *[!0-9]*) ;;
>     *) if test -z "$inum"; then
>          inum=$lsword
>        elif test $inum -ne $lsword; then
>        inum=
>        break
>        fi ;;
>   esac
> done &&
> test -n "$inum"
> 
> This uses just one fork+exec too, but it doesn't use the
> XSI notion of %% and ##.  It can be fooled if "$src"
> or "$dst" contains an integer surrounded by spaces, but
> any such errors cause it to fail in a conservative way
> (by doing needless remakes), and these errors should be
> rare so that's not so bad.
> 
> It assumes [!0-9] works, though;
> is that a safe assumption these days?

Yes, autoconf has been using [!...] negated shell patterns for years
now, with no problems on Solaris /bin/sh or any other shell.

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to