測试环境:ubuntu12.04 LTS版本号

echo >> file.txt就可以,

这样的方法对于脚本开头是bash和sh效果都一样,

而echo -e >> file.txt这样的仅仅适合与bash

对于sh,会输入-e到文件然后再换行。

而echo -e "\n" >> file.txt对于bash会连续换2行。

对于sh,会输入-e和一个新空行到文件。

解决shell脚本中 echo 怎么写入换行到文件的更多相关文章

  1. 【转】shell脚本中echo显示内容带颜色

    shell脚本中echo显示内容带颜色显示,echo显示带颜色,需要使用参数-e.格式如下:   echo -e "\033[41;36m something here \033[0m&qu ...

  2. shell脚本中echo显示内容带颜色

    转自:http://www.cnblogs.com/lr-ting/archive/2013/02/28/2936792.html shell脚本中echo显示内容带颜色显示,echo显示带颜色,需要 ...

  3. 【转】shell脚本中echo显示内容带颜色的实现方法

    shell脚本中echo显示内容带颜色的实现方法 shell脚本里使用echo输出颜色  

  4. 将window的shell脚本通过ftp传输到Linux服务器后, shell脚本中执行时提示“没有那个文件或目录”的解决办法

    出现bad interpreter:No such file or directory的原因,是文件格式的问题.这个文件是在Windows下编写的.换行的方式与Unix不一样,但是在vim下面如果不S ...

  5. 解决shell脚本中 telnet ap自动输入用户名和密码以及回车符

    #!/bin/bash function change_ap { ( s=`stty -g`; str=$"\n" sstr=$(echo -e $str) stty raw -e ...

  6. shell脚本中echo显示内容带颜色显示

    格式如下 : echo -e "\033[41;36m something here \033[0m" 其中41的位置代表底色, 36的位置是代表字的颜色 注: 1.字背景颜色和文 ...

  7. linux crontab执行shell脚本中包含相对路径的问题

    实例一 test.sh文件 echo `date`>test.log 配置crontab 设置 */1 * * * * sh /data/test.sh 在/data/目录下,未找到test.l ...

  8. shell脚本中给字符串添加颜色

    shell脚本中echo显示内容带颜色显示,echo显示带颜色,需要使用参数-e 格式如下: echo -e "\033[字背景颜色:文字颜色m字符串\033[0m" 例如: ec ...

  9. 让shell脚本中的echo输出带颜色

    转载自:http://www.linuxidc.com/Linux/2014-12/110463.htm 让echo输出带颜色的方法有两种 1.在shell脚本中定义颜色变量,使用echo -e调用变 ...

随机推荐

  1. oracle中区分audit_file_dest, background_dump_dest, core_dump_dest, user_dump_dest

    一般在$ORACLE_HOME\admin\{SID}目录下: audit_file_dest                 = /u01/app/oracle/admin/{SID}/adump ...

  2. Naive Bayes Theorem and Application - Theorem

    Naive Bayes Theorm And Application - Theorem Naive Bayes model: 1. Naive Bayes model 2. model: discr ...

  3. mybatis之动态SQL

    <if>的使用 如果第一个if不成立的话可能会出现where and的语法错误,解决方法是在外层加<where>标签,此时如果以and和or衔接where的话会被删除. < ...

  4. Windows Server 2012 R2 Standard序列号

    备用一个吧,免得用起来的时候找不到. NB4WH-BBBYV-3MPPC-9RCMV-46XCB

  5. 51nod 1237 最大公约数之和 V3(杜教筛)

    [题目链接] https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1237 [题目大意] 求[1,n][1,n]最大公约数之和 ...

  6. passwordauthentication yes

    ssh ip disconnected:no supported authentication methods available(server sent:publickey,gssapi-keyex ...

  7. 菱形java代码

    public class boy { //菱形 public static void main(String[] args) { int m=4; for (int i=0;i<=m;i++){ ...

  8. 恢复sudo的权限的命令

    出错的原因:不小心给了/etc/的所有文件的777属性,出现了sudo 的错误. 1.pkexec chmod 0440 /etc/sudoers 2.pkexec chmod 0440 /etc/s ...

  9. VB.NET版机房收费系统---SqlHelper

    SqlHelper,最早接触这个词儿的时候,好像是13年的暑假,那个夏天来的比往年来的稍晚一些,呵呵,sqlhelper,翻译成中文就是数据库助手,帮手.百度百科这样对她进行阐述: SqlHelper ...

  10. css版hover现边框

    需要注意的是  hover中要给盒子加:position:relative; <style type="text/css"> *{margin:0;padding:0; ...