How can you print text with an actual % sign in it using printf/sprintf ? e.g.
let fn = 5
printf "%i%" fn
gives a compile error. The obvious \%
doesn't work either.
Use "%%" where you want the % in the output text.
From the example above
let fn = 5
printf "%i%%" fn
will happily print "5%"
(Also if you want to print "%5" for some reason, the only way I found is to concatenate strings i.e.
"%"+ (printf "%i" 5)
because
printf "%%%i" 5
will not work either.)
You could always do something like:
let fn = 5
printf "%i%s" fn "%"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With