输出文本到终端:
echo "Hello, world!"
将文本输出到文件:
echo "Some text" > file.txt
追加文本到文件:
echo "More text" >> file.txt
展示当前的工作目录:
echo $PWD
展示当前的用户名:
echo $USER
将变量与文本一起输出:
name="John"
echo "My name is $name"
禁用换行符:
echo -n "This text will be printed on the same line"
启用转义字符:
echo -e "This text contains a tab character:\\tTab"