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任务系统(经测试)均适用)。
分类:
linux shell
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!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函数