echo "It is a test"
echo "\"It is a test\""
# 输出结果
"It is a test"
# read表示接收执行脚本的输入的第1行
# 编辑
[root@VM-12-15-centos home]# vi test.sh
# 编写如下
#!/bin/sh
read name
echo "$name It is a test"
# 执行
[root@VM-12-15-centos home]# sh test.sh
aa
aa It is a test
echo -e "OK! \n" # -e 开启转义
echo "It is a test"
# 执行结果
OK!
It is a test
#!/bin/sh
echo -e "OK! \c" # -e 开启转义 \c 不换行
echo "It is a test"
# 执行结果
OK! It is a test
echo "It is a test" > myfile
echo '$name\"'
# 输出结果
$name\"
[root@VM-12-15-centos home]# vi test.sh
# 编写如下
echo `date`
[root@VM-12-15-centos home]# sh test.sh
Mon May 13 19:30:23 CST 2024