short changing by ash
Pierre A. Humblet
humblet@eurecom.fr
Sun Feb 28 23:02:00 GMT 1999
> 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
More information about the Cygwin
mailing list