bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Parameter substring expansion not work for negative offset]


From: Frantisek Hanzlik
Subject: Re: [Parameter substring expansion not work for negative offset]
Date: Mon, 09 Sep 2013 15:54:15 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:23.0) Gecko/20100101 Firefox/23.0 SeaMonkey/2.20

Greg Wooledge wrote:
> On Sun, Sep 08, 2013 at 11:21:56AM -0500, Dennis Williamson wrote:
>> The man page says "Note that a negative offset must be separated from the
>> colon by at least one space..."
> 
> Enclosing the negative offset in parentheses also works.
> 
> The reason you must use either parentheses or spaces between them is
> because ${parameter:-word} has another, completely different meaning.
> 
>   ${foo:-1}
> 
> will expand to the contents of `foo' if it is set and not empty, or the
> literal string `1' otherwise.


Messieurs,

please excuse my stupidity. Although I'm using bash relatively often
including 'use default value' construct (${parameter:-word}), in this
case I somehow not joined this together.

And my failure to properly read through man page I rather will not
comment...

Thanks, Franta Hanzlík





reply via email to

[Prev in Thread] Current Thread [Next in Thread]