David C. Rankin wrote:
All,
I need a reference citation for the use of `printf -v` that writes the formatted output for a value to a variable. The use is:
printf -v varname "format specifier" value
example:
$ printf -v f "0x%02x" 13 $ echo $f 0x0d
I know how to use it, I just can't find a reference that tells me I can use it like that. I've checked the man pages and info coreutils/printf invocation, but I can't find a reference to the `-v` option anywhere.
Hardly a reference, but it's shown when you enter "printf --help" : per@io64:~> printf --help bash: printf: --: invalid option printf: usage: printf [-v var] format [arguments] "printf -v var" is new to me, I would have used $() instead: f=$(printf "0x%02x" 13) -- Per Jessen, Zürich (21.4°C) http://www.hostsuisse.com/ - dedicated server rental in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org