Re: Antw: Re: `${PARAMETER:OFFSET}' does not work for negative offset

2016-02-12 Thread Greg Wooledge
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

Antw: Re: `${PARAMETER:OFFSET}' does not work for negative offset

2016-02-12 Thread Ulrich Windl
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

Re: `${PARAMETER:OFFSET}' does not work for negative offset

2016-02-12 Thread Greg Wooledge
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

Re: `${PARAMETER:OFFSET}' does not work for negative offset

2016-02-12 Thread Pierre Gaston
_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... >

`${PARAMETER:OFFSET}' does not work for negative offset

2016-02-12 Thread Ulrich Windl
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