delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/12/23/15:38:22

From: pascal DOT lemaitre AT capgemini DOT fr (Pascal Lemaitre)
Subject: B20: bug in bash string substitution, ${var%%/*} eats last character
23 Dec 1998 15:38:22 -0800 :
Message-ID: <025701be2e8d$491482e0$a3640180.cygnus.gnu-win32@poste163>
Mime-Version: 1.0
To: <gnu-win32 AT cygnus DOT com>

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
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019