B20: bug in bash string substitution, ${var%%/*} eats last character

Pascal Lemaitre pascal.lemaitre@capgemini.fr
Wed Dec 23 10:49:00 GMT 1998


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@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list