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: Greg Wooledge
Subject: Re: [Parameter substring expansion not work for negative offset]
Date: Mon, 9 Sep 2013 07:42:40 -0400
User-agent: Mutt/1.4.2.3i

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.



reply via email to

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