delorie.com/archives/browse.cgi | search |
Delivered-To: | listarch-cygwin AT sourceware DOT cygnus DOT com |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
Sender: | cygwin-owner AT sourceware DOT cygnus DOT com |
Delivered-To: | mailing list cygwin AT sourceware DOT cygnus DOT com |
Date: | Fri, 12 Feb 1999 14:06:39 +0100 (MET) |
From: | "Pierre A. Humblet" <humblet AT eurecom DOT fr> |
To: | cygwin AT sourceware DOT cygnus DOT com |
Subject: | Re: short changing by ash |
Message-ID: | <Pine.SOL.3.96.990212140253.14050A-100000@pauillac.eurecom.fr> |
MIME-Version: | 1.0 |
> Date: Thu, 11 Feb 1999 17:23:07 +0000 > From: Don Sharp <Don DOT Sharp AT dddandr DOT octacon DOT co DOT 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |