I was using printf to format a number in bash:
$ printf -- ">>%4d
" 1
>> 1
This works fine, but when i do the same thing in a subshell:
$ echo $(printf -- ">>%4d
" 1)
>> 1
Why are the spaces removed? I have absolutely no idea.
See Question&Answers more detail:os