+ -
当前位置:首页 → 问答吧 → while do中的设定的变量,循环以外不能使用?

while do中的设定的变量,循环以外不能使用?

时间:2011-02-15

来源:互联网

cat file|while read f
do
  a=111
done
echo $a
为什么echo $a为空?
有什么办法在while do里的变量用于其他地方?

作者: baoyu05   发布时间: 2011-02-15

while read var
do
   .. $var ...
done <file

作者: ywlscpl   发布时间: 2011-02-15

不要用管道开辟子进程

作者: justlooks   发布时间: 2011-02-15

多谢两位

作者: baoyu05   发布时间: 2011-02-15

热门下载

更多