use IFS in bash


use IFS in bash
 
[python] 
function dfd()  
{  
    #http://www.2cto.com/os/201309/243382.html
    IFS=$'\n'  
    for i in $(lsd);do  
        du -sh "$i";  
    done   
}  
 
[html] 
#!/bin/bash  
IFS_old=$IFS      #将原IFS值保存,以便用完后恢复  
IFS=$’\n’         #更改IFS值为$’\n’  
for line in `cat file.txt`  
do  
echo $line  
done  
 

相关内容

    暂无相关文章