linux命令执行顺序管理

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

 

posted @ 2019-02-25 17:48  sunnyamy  阅读(191)  评论(0编辑  收藏  举报