On Mon, Apr 24, 2017 at 12:59:01PM +0200, wer...@suse.de wrote: > V_NAME=Friday > for (( INDEX=0; INDEX<$((10-$(expr length $V_NAME))); INDEX++ ))
The outer (( )) in the C-style for loop already create an arithmetic expression context. You don't need to use $(( )) inside them. You can simply write: for (( INDEX=0; INDEX<10-${#V_NAME};; INDEX++ )) By the way, the [ ] index syntax in an indexed (not associative) array expansion works the same way. You can simply write: "${a[x+1]}" instead of "${a[$((x+1))]}"