Subject: B20: bug in bash string substitution, ${var%%/*} eats last character
From: [email-masked] (Pascal Lemaitre)

23 Dec 1998 15:38:22 -0800
Message-ID: <025701be2e8d$491482e0$a3640180.cygnus.gnu-win32@poste163>
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
To: <[email-masked]>

The following script does not work correctly as a file, whereas it does in
interactive mode. Here is what happens :
----------------------------------------------------------------------------
--
poste163:~> exemple.sh
Gdm/Noy -- Gd
Gdm/Noy -- Gd
Longueur/largeur -- Longueu

poste163:~>. exemple.sh
Gdm/Noy -- Gdm
Gdm/Noy -- Gdm
Longueur/largeur -- Longueur
----------------------------------------------------------------------------
--

The script text is:
----------------------------------------------------------------------------
--
for tst in Gdm/Noy "Gdm/Noy" Longueur/largeur
do
    echo $tst '--' ${tst%%/*}
done
----------------------------------------------------------------------------
--

PS: it is not easy to find if a similar bug has already been reported.

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".