printf
按照格式輸出
\"雙引號
\\反斜線
\a 警告聲
\b 退一格
\c\c以後的字符不在顯示
\e 逃逸符,printf \\e
\f form feed 換頁
\n 換行
\r 回車(carriage return),以前的字符不在顯示
\t 水平製表符(horizontal tab),tab縮進
\v 垂直製表符(vertical tab),同\f
\NNN 指定八進制(octal)參數NNN(1~3個整數)顯示字符或字母
\xHH指定十六進制(hexadecimal)參數HH(1~2個整數),顯示爲相應的字母或數字
\uHHHH指定十六進制參數顯示ISO/IEC 10646 unicode字符,HHHH(4個整數)
\UHHHHHHHH指定十六進制參數顯示unicode字符,HHHHHHHH(8個整數)
%%單個百分號
printf %%\\n
%
%b 同\反斜線,
[root@os5 ~]# printf "the year is 2016."
the year is 2016.[root@os5 ~]#
[root@os5 ~]# echo "the year is 2016."
the year is 2016.
[root@os5 ~]# printf "the year is 2016.\n"
the year is 2016.
[root@os5 ~]# printf "the year is 2016.\ntoday is 26.\n"
the year is 2016.
today is 26.
[root@os5 ~]# printf "the year is 2016.\ntoday is 26."
the year is 2016.
today is 26.[root@os5 ~]#