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: > offset}" and "${parameter: offset:length}", respectively. Or change the > wording of "If offset evaluates to a number less than zero" to "If offset > evaluates to a number less than zero AND begins with a space"
Gah, long lines. The man page says: If offset evaluates to a number less than zero, the value is used as an offset in characters from the end of the value of parameter. If length evaluates to a number less than zero, it is interpreted as an offset in characters from the end of the value of parameter rather than a number of characters, and the expansion is the characters between offset and that result. Note that a negative offset must be separated from the colon by at least one space to avoid being confused with the :- expansion. Either that last sentence wasn't present in the 4.2 man page, or you simply missed it.