shell echo
目录
shell echo命令
shell echo一般字符串
shell echo转义字符串
shell echo插入变量
shell echo换行
shell echo不换行
shell echo命令
shell echo用于字符串的输出。
echo str
shell echo一般字符串: 结果 hello world
echo "hello world"
shell echo转义字符串:结果 "hello world"
echo "\"hello world\""
shell echo插入变量:结果 hello world is a great world
#!/bin/bash
str="hello world"
echo "${str} is a great world"
shell echo换行
echo -e "hello world \n" # -e 开启转义
shell echo不换行
echo -e "hello world \c"
shell echo输出结果到文件
1. 覆盖file中所有的内容
echo "hello world" > file
2. 在file的最后一行换行写入
echo "hello world" >> file
shell echo显示命令执行的结果
echo `ls` ls=`ls` echo $ls

浙公网安备 33010602011771号