I have a bash script shell that has a line:
g=$(/bin/printf ${i})
when ${i} contains something like -6 , printf thinks the option is passed to it. It does not recognize the parameter, so an error occurs.
if wrap ${i} in quotation marks, printf still thinks that an option is passed to it.
g=$(/bin/printf "${i}")
if I run away from quotes, the variable $g , then " -6 " is executed, which is also not what I want.
g=$(/bin/printf \"${i}\")
Get out to avoid the dash (-).
printf is a BusyBox application
source share