$ printf "a string,no processing: <%s> \n" "A\nB"
a string,no processing: <A\nB> 默认情况下转义序列不会被解释
当使用 %b 格式指示符时 printf 会解释参数字符串的转义序列
printf "a string,no processing: <%b> \n" "A\nB"
a string,no processing: <A
B>
printf "|%10s|\n" hello
| hello|
|表示字符串实际宽度向右对其 不足十个字符则左端自动补领
printf "|%-10s|\n" hello
|hello |
左对齐 注意是键盘上减号那个建表示非
printf "|%${width}.${prec}G|\n" $myvar
|3.14159|
等同于printf "|%*.*G|\n" 5 6 $myvar
|3.14159|
echo "\$x is \"$x\". here is some outpu: '$(echo hello world)'"
$x is " i am x". here is some outpu: 'hello world'
$ \ 若用到字面上的意思则前面要加\