I have some items:
items=(one two three) And I want to print them with leading -, to give this output:
- one - two - three The obvious format string fails:
printf '- %s\n' "${items[@]}" bash: printf: - : invalid option printf: usage: printf [-v var] format [arguments] I tried using \- in the format string, but that results in literal \- in the output.
If I could assume ASCII, I might get away with \055, but is there a portable way to write this?
Note about dashes sign -.in ths anwser