shell编程 拿到标准输入

在shell编程中我们可以通过$1拿到参数 

如    ./myscript.sh   aaaa

这时  $1 就是  aaaa

但假如我们想拿到通道给我们的标准输入呢?

如    ls -l  |  ./myscript.sh   想拿到 ls -l 的输出呢

这时可以这样

扫描二维码关注公众号,回复: 1314578 查看本文章
while read inputline
do
  echo input  = $inputline 
done 
 

猜你喜欢

转载自renxiangzyq.iteye.com/blog/1335934