On 08/20/2014 07:05 AM, [email protected] wrote: Not a bug.
>
> Description:
> Substring Expansion actually works different than manpage states,
> namely:
>
> "If offset evaluates to a number less than zero, the value is used as
> an offset from the end of the value of parameter."
Read further.
"Note that a negative offset must be separated from the colon by at
least one space to avoid being confused with the :- expansion."
>
> Repeat-By:
> x="abcdef"; echo "${x:-2}"
> Expected: ef
> Got: abcdef
echo "${x: -2}"
>
> or:
> x="abcdef"; echo "${x:-2:1}"
> Expected: e
> Got: abcdef
echo "${x: -2:1}"
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
