Shell echo命令 发表于 2016-08-13 | 分类于 Shell 显示普通字符串:1echo "It is a test" 显示转义字符1echo "\"It is a test\"" 结果将是: 1"It is a test" 显示变量12name="Tom" echo "Hello $name" 显示换行12echo -e "OK! \n" # -e 开启转义echo "It it a test" 输出结果: 123OK!It it a test 显示不换行12echo -e "OK! \c" # -e 开启转义 \c 不换行echo "It is a test" 输出结果: 1OK! It is a test 显示结果定向至文件1echo "It is a test" > myfile 原样输出字符串,不进行转义或取变量(用单引号)1echo '$name\"' 输出结果: 1$name\" 显示命令执行结果1echo `date`