懒龙谷
  • Home
  • Categories
  • Tags
  • Archives

shell_string

shell string总结

  1. 空串判断 if [ -z "$line" ]

  2. 在awk使用时,全部是数字的外部string变量需要前后加双引号,不然会当作数值,打印时会出bug

  3. for循环遍历文件时,使用 for line in cat $filename 缺点: 当行内有空格时,一行会被划分成两行

  4. 上一条的替代方法 while read line do done < filename 缺点:过程中需要 命令行交互时, 无法输入命令。

this guy is lazy, nothing leave

Comments
comments powered by Disqus

  • « ksh_数学运算
  • markdown_syntax »

Published

Jan 22, 2014

Category

shell

Stay in Touch

  • Powered by Pelican. Theme: Elegant by Talha Mansoor