编辑echo.sh
#!/bin/sh
echo "输入testName:"
read testName
echo
echo "It is a test:$testName."
echo
echo -e "转义换行:OK! \n It is a test" # -e 执行转义\n 换行
echo -e "转义不换行OK! \c" # -e 执行转义\c 不换行
echo "It is a test"
echo "It is a test:$testName">getStringFile #输出到文件
echo `date`>>getStringFile
echo '\$testName:'
echo "$testName"
执行echo.sh
./echo.sh
输入testName:
123456
It is a test:123456.
转义换行:OK!
It is a test
转义不换行OK! It is a test
\$testName:
123456
同时生成文件getStringFile
网友评论