On Tue, Oct 12, 2004 at 10:42:24AM +0200, jochen@puchalla-online.de wrote:
[...]
> export bla=bla.WaV
> echo ${bla:-3}
>
> This should deliver "WaV", following the manpage, but I get "bla.WaV"
[...]
Yes, that's a design bug borrowed from ksh. The behavior you are
observing is the Bourne one described at:
info -f bash -n 'Shell Parameter Expansion'
`${PARAMETER:-WORD}'
If PARAMETER is unset or null, the expansion of WORD is
substituted. Otherwise, the value of PARAMETER is substituted.
What you want is ${bla: -3} or ${bla:0-3}
Or the POSIX: ${bla#"${bla%???}"}
--
Stephane
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________