shell中任务递交后修改循环配置文件效果

 

001、 投递该任务

复制代码
(base) [b20223040323@admin1 test]$ ls
a.txt  record.sh
(base) [b20223040323@admin1 test]$ cat a.txt    ##  循环配置文件
1       1000000000
2       500000000
(base) [b20223040323@admin1 test]$ cat record.sh  ## 测试程序
#!/bin/bash

cat a.txt | while read {i,j}
do
        seq $j | tac > $i.txt
        echo $i done
done
(base) [b20223040323@admin1 test]$ bash record.sh
复制代码

 

002、在第一行的循环未执行完的情况下删除循环配置文件a.txt的第二行(另一个终端窗口操作), 观察程序是否执行第二行的循环

复制代码
(base) [b20223040323@admin1 test]$ ls
1.txt  a.txt  record.sh
(base) [b20223040323@admin1 test]$ cat a.txt
1       1000000000
2       500000000
(base) [b20223040323@admin1 test]$ sed '$d' a.txt -i
(base) [b20223040323@admin1 test]$ cat a.txt
1       1000000000
(base) [b20223040323@admin1 test]$ ls
1.txt  a.txt  record.sh
复制代码

 

003、等待程序运行完,观察结果文件

 

(base) [b20223040323@admin1 test]$ ls             ## 两行的循环结果文件都生成 
1.txt  2.txt  a.txt  record.sh
(base) [b20223040323@admin1 test]$ head -n 2 1.txt
1000000000
999999999
(base) [b20223040323@admin1 test]$ head -n 2 2.txt
500000000
499999999

 

004、小结: 

任务一旦投递,修改循环配置文件,对整个程序无影响(在shell终端, slurm任务系统(经测试)均适用)。

 

posted @   小鲨鱼2018  阅读(38)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
历史上的今天:
2022-05-13 R语言中prod()、cumprod()函数
2022-05-13 R语言中range函数
2022-05-13 R语言中滞后差分 diff()函数
2022-05-13 R语言中set.seed函数的作用
2022-05-13 R语言中pmin、pmax函数
点击右上角即可分享
微信分享提示