Re: Substring expansion error when offset contains a colon

2015-10-26 Thread Chet Ramey
On 10/19/15 3:45 AM, grishale...@gmail.com wrote: > When using ${parameter:offset:length} expansion, the parser doesn't account > for all the ways that a colon can appear in "offset". > > For example: > > $ echo ${PARAM:${OFFSET:-0}} > -bash: ${OFFSET: bad substitution > > or: > > # declare -A

Substring expansion error when offset contains a colon

2015-10-19 Thread grishalevit
When using ${parameter:offset:length} expansion, the parser doesn't account for all the ways that a colon can appear in "offset". For example: $ echo ${PARAM:${OFFSET:-0}} -bash: ${OFFSET: bad substitution or: # declare -A A=([a:b]=0) # echo ${PARAM:${A[a:b]}} -bash: ${A[a: bad substitution I