自己开发的过程中,我从数据库里读出来一个值,写入某个临时文件,再让脚本做 cat tmp.log |while read line  的时候

readline每次都是少一行,

最后发现,是换行符的问题   从数据库读出的是纯字符,没有换行,需要手动添加一个"\n"  问题解决

偶遇bash 的while read line 的问题的更多相关文章

  1. Bash Shell read file line by line and substring

    #read one file line by line for line in $(cat test1.txt); do echo $line ; done; #while read split li ...

  2. (转载)基于Bash命令行的百度云上传下载工具

    原文链接:http://hi.baidu.com/meoow/item/aef5814bbd5be3e1bcf451e9 这是我根据百度云PCS的API写的一个基于bash的命令行工具, 使用了cur ...

  3. Returning Values from Bash Functions

    转自:https://www.linuxjournal.com/content/return-values-bash-functions Bash functions, unlike function ...

  4. echo "This is line $LINENO"返回行号

    echo "This is line $LINENO"返回行号 LINENO 变量LINENO返回它在脚本里面的行号. #!/bin/bash echo "This is ...

  5. Shell碎碎念

    1. 字符串如何大小写转换 str="This is a Bash Shell script." 1> tr方式 newstr=`tr '[A-Z]' '[a-z]' < ...

  6. Fedora 22中的用户和用户组管理

    The control of users and groups is a core element of Fedora system administration. This chapter expl ...

  7. 每天写点shell--命令行参数

    1.读取参数:位置参数变量是标准的数字: $0是程序名, $1是第一个参数, $2是第二个参数... #!/bin/bash # using one command line parameter fa ...

  8. Ubuntu 12.04 安装MySQL

    本文地址:http://www.cnblogs.com/yhLinux/p/4012689.html 本文适合新手入门. 本文是对 Ubuntu 12.04 环境下安装 MySQL 的记录,通过这两天 ...

  9. Linux、Windows Server Password Security Policy Strengthen

    catalog . windows Security and Protection(Logon and Authentication) . windows密码强制安全策略 . PAM(Pluggabl ...

随机推荐

  1. C#某月的第一天和最后一天

    1.本月的第一天===>DateTime.Now.AddDays(1 - DateTime.Now.Day);//当前日期减去当前日期和本月一号相差天数 2.本月的最后一天===>Date ...

  2. 如何将OpenTSDB源码导入eclipse

    OpenTSDB的官网上介绍了如何将OpenTSDB源码导入eclipse,官方链接,但步骤超级繁琐,还有一个简便方法,下面以导入OpenTSDB2.0.0为例. 1. 下载OpenTSDB2.0.0 ...

  3. HTTP 协议入门(转载)

    作者:阮一峰 (@ruanyf) www.ruanyifeng.com/blog/2016/08/http.html HTTP 协议是互联网的基础协议,也是网页开发的必备知识,最新版本 HTTP/2 ...

  4. JS 数组的一些方法

    1.push() //可以接受任意参数,然后添加到数组的末尾 2.pop()//栈方法,在数组末尾删除一条数据,并且返回这条数据 3.shift()//队列方法,与pop()相似,但是与其相反,在数组 ...

  5. Elasticsearch之curl创建索引库

    关于curl的介绍,请移步 Elasticsearch学习概念之curl 启动es,请移步 Elasticsearch的前后台运行与停止(tar包方式) Elasticsearch的前后台运行与停止( ...

  6. 多对多 hibernate映射

    数据库: create table EMPLOYEE ( EMPID NUMBER(6) not null, EMPNAME VARCHAR2(32) ) alter table EMPLOYEE a ...

  7. php学习笔记-php中把浮点数转化为整数

    在php中有时候会遇到比如 14.6%3这种操作,php是会先把14.6转化为整数再做其它的操作,那么这个转化为整数的操作是floor(14.6)还是ceil(14.6)还是round(14.6)呢? ...

  8. hadoop主节点(NameNode)备份策略以、恢复方法、操作步骤

    一.dits和fsimage      首先要提到两个文件edits和fsimage,下面来说说他们是做什么的. 集群中的名称节点(NameNode)会把文件系统的变化以追加保存到日志文件edits中 ...

  9. 6、perl创建模块(Exporter)及路径 引用 嵌套 查询模块

    参考博客:http://www.cnblogs.com/xudongliang/tag/perl/ 1.perl 模块的创建以及制定perl 模块的路径 (1)创建一个Myfun.pm模块. #/us ...

  10. ES Docs-1:Installation Elasticsearch-2.3.1

    installation Elasticsearch requires at least Java 7. Specifically as of this writing, it is recommen ...