2013-03-03 03:15:34 +08:00
|
|
|
printf "Hello %d %i %f %F %g %G\n" 1 2 3 4 5 6
|
|
|
|
|
2013-04-04 09:04:17 +08:00
|
|
|
printf "%x %X %o %llu\n" 10 11 8 -1
|
2014-11-02 15:27:52 +08:00
|
|
|
# %a has OS-dependent output - see #1139
|
|
|
|
#printf "%a %A\n" 14 15
|
2013-03-03 03:15:34 +08:00
|
|
|
|
|
|
|
printf "%c %s\n" a hello
|
2014-09-22 14:19:57 +08:00
|
|
|
printf "%c%c%c\n" hello … o
|
2013-03-03 03:15:34 +08:00
|
|
|
printf "%e %E\n" 5 6
|
|
|
|
|
|
|
|
printf "%20d\n" 50
|
|
|
|
printf "%-20d%d\n" 5 10
|
|
|
|
|
|
|
|
printf "%*d\n" 10 100
|
|
|
|
|
|
|
|
printf "%%\"\\\n"
|
|
|
|
printf "%s\b%s\n" x y
|
|
|
|
printf "abc\rdef\n"
|
|
|
|
printf "Msg1\fMsg2\n"
|
|
|
|
printf "foo\vbar\vbaz\n"
|
2013-03-29 14:56:15 +08:00
|
|
|
printf "\111 \x50 \u0051 \U00000052"
|
2013-03-25 06:24:29 +08:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Test escapes"
|
|
|
|
|
|
|
|
# \c escape means "stop printing"
|
|
|
|
printf 'a\cb'
|
|
|
|
echo
|
|
|
|
|
|
|
|
# Bogus printf specifier, should produce no stdout
|
|
|
|
printf "%5" 10 ^ /dev/null
|
|
|
|
|
|
|
|
true
|