Linux shell - while 循环对外部变量的处理
来源:互联网 发布:java幂等性是什么意思 编辑:程序博客网 时间:2024/05/18 19:18
用过linux shell里面的while循环的都知道,循环里面对外部变量的修改是不生效的。比如:
variable = old_value
cat file | while read line
do
do something
variable = new_value
done
echo $varable
=============================
输出将会是:old_value
解决办法:
variable = old_value
while read line
do
do something
variable = new_value
done < file
echo $variable
=============================
输出将会是:new_value
0 0
- Linux shell - while 循环对外部变量的处理
- shell的while循环
- block 对外部引用变量的处理
- block 对外部引用变量的处理
- linux shell编程while循环
- shell里的while循环
- 关于while read line循环的linux bash shell bug
- Linux 下的 shell 编程之 while 循环
- linux 下的Shell编程之while、until循环
- Shell的while循环和until循环
- Linux shell 循环for and while
- Bash shell,while 循环中的变量无法保存问题
- shell 预定义变量, for while循环 ,函数
- linux shell 对两个文件的处理
- shell 循环语句while的使用
- Linux shell学习(六)while循环 until循环
- Linux shell 编程之while循环、until循环
- Shell编程中使用管道循环中无法改变外部变量的解决办法
- 内部类
- 一起学CC3200系列教程之跑马灯---库
- 使用 XACT_ABORT
- Codeforces Round #296 (Div. 2) + 今天的收获
- PB9.0连接sqlserver2008 R2
- Linux shell - while 循环对外部变量的处理
- ad9导出pcb封装的方法
- 算法训练 最小乘积(基本型)
- 快速上手Unity中最好的补间动画插件DFTween
- 基于 XMLHttpRequest实现的Ajax请求
- How to use Mantis with Eclipse
- @@ERROR第二个例子中使用XACT_ABORT以后,第二条语句这回就无效了。
- Linux虚机挂载ISO光盘镜像并配置yum
- 值得学习的C语言开源项目