bi.sh文件内容如下:
#!/bin/bash date1=$1 round=$2 if [ "$date1" == "" ];then date1=$(date "+%Y%m%d") fi if [ "$round" == "" ];then round=6 fi pro=`ps aux | grep test.sh | awk ‘END{print NR}‘` while(($pro > 1)) do `echo "$date1 sleep!" >> res.txt` sleep 5 pro=`ps aux | grep test.sh | awk ‘END{print NR}‘` done `echo "$date1 is running!" >> res.txt` `sh test.sh $date1 $round`
test.sh文件内容如下:
#!/bin/bash date=$1 i=1 while(( $i<=$2 )) do `echo "$i:hello" >> res.txt` sleep 5 let "i++" done
原文地址:https://www.cnblogs.com/greatai/p/10432294.html
时间: 2024-11-08 23:01:02