[root@server5 local]# echo "hello shell"
hello shell
[root@server5 local]# printf "hello shell"
hello shell[root@server5 local]# # printf "hello shell\n"
hello shell
[root@server5 local]#
(1)(-表示左对齐,没有则表示右对齐)
(2)赋值语句的等号左右切记不要有空格!
(3)第一个echo hello会被视作一个命令,第二个hello会被单独视为一个命令!
[root@server5 local]# echo hello;hello
hello
-bash: hello: 未找到命令
(4)bash不会对单引号中的变量(如$var)求值,而只是照原样输出。
(5)while using flags for echo and printf, alwanys make sure thatthe flags appear before any strings inthe command,otherwise Bash will consider the flags as another string.
What's meaning of"flags?"
(6)[root@server5 local]# echo -e "\e[1;31m this is red txt \e[0m"
this is red txt
\e[1;31m isthe escape stringthat sets the color to red
\e[0m resets the color back.