echo

作者: 9016 | 来源:发表于2022-12-17 15:21 被阅读0次

    编辑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

    相关文章

      网友评论

          本文标题:echo

          本文链接:https://www.haomeiwen.com/subject/hmllqdtx.html