摘要: 001、为了避免脚本多次执行,生成结果多次追加,可以在追加语句的前面增加清空语句避免多次追加 [root@pc1 test1]# ls a.sh [root@pc1 test1]# cat a.sh ## 测试脚本 #!/bin/bash > result.txt ## 或者使用 rm -f res 阅读全文
posted @ 2024-03-06 10:59 小鲨鱼2018 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 001、在特定的情况下,为了防止脚本重复执行,造成混乱,可以在末尾追加如下语句避免脚本重复执行 [root@pc1 test1]# ls a.sh [root@pc1 test1]# cat a.sh ## 测试脚本 #!/bin/bash seq 2 seq 2 sed -i 's/^/#/' $ 阅读全文
posted @ 2024-03-06 10:44 小鲨鱼2018 阅读(47) 评论(0) 推荐(0) 编辑