You know that the
printf function written in
C allows to do:
printf('%2$s %2$s %1%s %1%s', 'World', 'Hello');
Hello Hello World World
printf '%2$s %2$s %1%s %1%s' 'World' 'Hello'
bash: printf: $': invalid format character
/usr/bin/printf '%2$s %2$s %1%s %1%s' 'World' 'Hello'
/usr/bin/printf: %2$: invalid conversion specification
How to obtain the
C behavior in Bash? Thanks.
I was curious about this behaviour, I don't want a workaround.
E.g. think about GNU Bash source code internationalization. Very improbable without this feature.