I'm trying to concatenate strings in bash using printf
by following the examples here:
$ printf "%s " "hello printf" "in" "bash script"
The above works. But when I try to add to the format string some dashes (-
):
$ printf "--file=%s " "hello printf" "in" "bash script"
it generates an error:
sh: printf: --: invalid option
Obviously, it's treating the format string as an option. How can I include dashes -
into the output?
(I tried to add use \-
to escape the dashes, to no avail.)