On Fri, Feb 12, 2016 at 02:45:23PM +0100, Ulrich Windl wrote:
> I realized that ":-2" is ambiguous: Default value or substring? A SPC does
> disambiguate (now I know). I still wonder why the manual page does not change
> "${parameter:offset}" and "${parameter:offset:length}" to "${parameter:
> o
I realized that ":-2" is ambiguous: Default value or substring? A SPC does
disambiguate (now I know). I still wonder why the manual page does not change
"${parameter:offset}" and "${parameter:offset:length}" to "${parameter:
offset}" and "${parameter: offset:length}", respectively. Or change the
On Fri, Feb 12, 2016 at 09:22:21AM +0100, Ulrich Windl wrote:
> "X=ABC; echo ${X:-2}" outputs "ABC", and not "BC"
When using a negative index/offset, you have to separate it from the
colon so that it is not interpreted as a ${var:-default} substitution.
There are many ways to write it:
${x
_64-suse-linux-gnu
>
> Bash Version: 4.2
> Patch Level: 47
> Release Status: release
>
> Description:
> `${PARAMETER:OFFSET}' does not work for negative offset; the complete
> parameter value is substituted
>
> The bug goes back to at least bash 3.2...
>
Linux pc 4.1.15-8-default #1 SMP PREEMPT Wed Jan 20 16:41:00 UTC
2016 (0e3b3ab) x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-suse-linux-gnu
Bash Version: 4.2
Patch Level: 47
Release Status: release
Description:
`${PARAMETER:OFFSET}' does not work for negative offset; the complete