1. 程式人生 > >linux命令執行順序管理

linux命令執行順序管理

sleep 文件 done 命令 執行 管理 let grep color

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

linux命令執行順序管理