I'm trying to use printf to format some pretty output in a bash script
e.g.:
-----------------------
| This is some output |
-----------------------
But I've stumbled over some behavior I don't understand.
$ printf "--"
gives me the error:
printf: usage: printf [-v var] format [arguments]
and
$ printf "-stuff"
results in
-bash: printf: -s: invalid option
So apparently printf thinks I'm trying to pass some arguments while I'm not.
Meanwhile, completely by accident, I've found this workaround:
$ printf -- "--- this works now ----\n"
gives me
--- this works now ----
Can anyone explain this behavior?