`
xitongyunwei
  • 浏览: 926652 次
文章分类
社区版块
存档分类
最新评论

use IFS in bash

 
阅读更多

function dfd()
{
    #http://www.cnblogs.com/hunterfu/archive/2010/02/23/1672129.html
    IFS=$'\n'
    for i in $(lsd);do
        du -sh "$i";
    done 
}

  #!/bin/bash
  IFS_old=$IFS      #将原IFS值保存,以便用完后恢复
  IFS=$’\n’         #更改IFS值为$’\n’
  for line in `cat file.txt`
  do
  echo $line
  done

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics