This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: short changing by ash





> Date: Thu, 11 Feb 1999 17:23:07 +0000
> From: Don Sharp <Don.Sharp@dddandr.octacon.co.uk>
> Subject: short changing by ash
> 
> You may be interested in the following differences in behaviour
> between bash and (a)sh. ash comes up with one character less.

Here are similar problems with %% and with ##   (b20.1)

Pierre

******************************************

~/bin/source/misc: cat try_ash
a=-1
echo SHOULD BE EMPTY: A${a##-*}Z "A${a##-*}Z"
echo SHOULD BE EMPTY: A${a%%-*}Z "A${a%%-*}Z"

if test -n "${a##-*}"
 then
 echo 1 Should not see this "A${a##-*}Z"
fi

if test -z "${a##-*}"
 then
 echo 2 Should see this "A${a##-*}Z"
fi

if test -n "${a%%-*}"
 then
 echo 3 Should not see this "A${a%%-*}Z"
fi

if test -z "${a%%-*}"
 then
 echo 4 Should see this "A${a%%-*}Z"
fi
******************************************

~/bin/source/misc: bash try_ash
SHOULD BE EMPTY: AZ AZ
SHOULD BE EMPTY: AZ AZ
2 Should see this AZ
4 Should see this AZ
******************************************

~/bin/source/misc: sh try_ash
SHOULD BE EMPTY: AZ AZ
SHOULD BE EMPTY: Z A-1Z
1 Should not see this AZ
2 Should see this AZ
3 Should not see this A-1Z