偶遇bash 的while read line 的问题
自己开发的过程中,我从数据库里读出来一个值,写入某个临时文件,再让脚本做 cat tmp.log |while read line 的时候
readline每次都是少一行,
最后发现,是换行符的问题 从数据库读出的是纯字符,没有换行,需要手动添加一个"\n" 问题解决
偶遇bash 的while read line 的问题的更多相关文章
- 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 ...
- (转载)基于Bash命令行的百度云上传下载工具
原文链接:http://hi.baidu.com/meoow/item/aef5814bbd5be3e1bcf451e9 这是我根据百度云PCS的API写的一个基于bash的命令行工具, 使用了cur ...
- Returning Values from Bash Functions
转自:https://www.linuxjournal.com/content/return-values-bash-functions Bash functions, unlike function ...
- echo "This is line $LINENO"返回行号
echo "This is line $LINENO"返回行号 LINENO 变量LINENO返回它在脚本里面的行号. #!/bin/bash echo "This is ...
- Shell碎碎念
1. 字符串如何大小写转换 str="This is a Bash Shell script." 1> tr方式 newstr=`tr '[A-Z]' '[a-z]' < ...
- Fedora 22中的用户和用户组管理
The control of users and groups is a core element of Fedora system administration. This chapter expl ...
- 每天写点shell--命令行参数
1.读取参数:位置参数变量是标准的数字: $0是程序名, $1是第一个参数, $2是第二个参数... #!/bin/bash # using one command line parameter fa ...
- Ubuntu 12.04 安装MySQL
本文地址:http://www.cnblogs.com/yhLinux/p/4012689.html 本文适合新手入门. 本文是对 Ubuntu 12.04 环境下安装 MySQL 的记录,通过这两天 ...
- Linux、Windows Server Password Security Policy Strengthen
catalog . windows Security and Protection(Logon and Authentication) . windows密码强制安全策略 . PAM(Pluggabl ...
随机推荐
- UDK编辑器 49条小提示
转自:http://www.cnblogs.com/hmxp8/archive/2012/02/09/2343674.html Very Helpful~ 01. First time using t ...
- Linux系统主流架构一
Linux系统主流架构一 随着IT运维的不断发展,尤其的Linux的飞速发展,越来越多的企业开始使用Linux操作系统,例如:Centos.Red Hat.Ubuntu.Fadora等等,成千上亿个网 ...
- ss2
一. *** 服务端配置 1. 在命令行窗口输入下面4行命令并回车执行 yum -y update yum install -y python-setuptools && easy_i ...
- Hander----使用
public class MainActivity extends Activity { private EditText UITxt; private Button updateUIBtn; pri ...
- RN控件之DrawerLayoutAndroid导航栏
/** * Sample React Native App * https://github.com/facebook/react-native */ 'use strict'; import Rea ...
- Learning Python 009 dict(字典)和 set
Python dict(字典)和 set dict (字典)是什么东西 dict全称dictionary.为什么这个数据结构取名叫dict.因为dict的实现原理和查字典是一样的.dict使用了键-值 ...
- MySql中的锁(表锁,行锁)
锁是计算机协调多个进程或春线程并发访问某一资源的机制.在数据库中,除传统的计算资源(CPU,RAM,I/O)的争用之外,数据也是一种工许多用户共享的资源.如何保证数据并发访问的一致性,有效性是所有数据 ...
- hdu1078
#include <stdio.h> #include <string.h> #include <algorithm> using namespace std; i ...
- ibatis知识点汇总
一个参数,返回Map <select id="getShopInfo" parameterClass="java.lang.String" resultC ...
- Syslog+Fluentd+InfluxDB日志收集系统搭建
环境配置 节点 配置 类型 操作系统 Sched 2G 2CPU 50GB ens3=>192.168.200.11 KVM虚拟机 CentOS 7 Nova 4G 2CPU 50GB ens3 ...