美文网首页Work, Work~
shell echo写入多行文字到文本中

shell echo写入多行文字到文本中

作者: 海边的贝壳林 | 来源:发表于2018-05-10 21:35 被阅读0次

    转载自:http://blog.sina.com.cn/s/blog_8732f19301019ucn.html

    单行文本

    #! /bin/bash
    echo Hello > filename.txt
    

    多行文本

    #! /bin/bash
    echo "测试写文件"
    cat>test1<<EOF
    这是一个由shell创建的文件
    this is a file created by shell.
    we want to make a good world.
    EOF
    

    其中,<<EOF 表示当遇到EOF时结束输入。

    cat>test1<<EOF 这间没有空格

    相关文章

      网友评论

        本文标题:shell echo写入多行文字到文本中

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