zoukankan      html  css  js  c++  java
  • shell 多进程运行程序

    code1

    macname@localhost Desktop % 
    macname@localhost Desktop % cat test.sh 
    #!/bin/bash
    echo "Start the test script"
    count=1
    while [ $count -le 5 ]
    do
       echo "Loop #$count"
       sleep 5
       count=$[ $count + 1 ]
    done
    echo "Test script is complete" 
    macname@localhost Desktop % 
    macname@localhost Desktop % ./test.sh 
    Start the test script
    Loop #1
    Loop #2
    Loop #3
    Loop #4
    Loop #5
    Test script is complete
    macname@localhost Desktop % 
    macname@localhost Desktop % 

    code2

    macname@localhost Desktop % 
    macname@localhost Desktop % 
    macname@localhost Desktop % cat test.sh 
    #!/bin/bash
    echo "Start the test script"
    ./a.sh &
    ./a.sh &
    ./a.sh &
    macname@localhost Desktop % 
    macname@localhost Desktop % 
    macname@localhost Desktop % cat a.sh 
    #!/bin/bash
    echo "Start the test script"
    count=1
    while [ $count -le 5 ]
    do
       echo "Loop #$count"
       sleep 5
       count=$[ $count + 1 ]
    done
    echo "Test script is complete" 
    macname@localhost Desktop % 
    macname@localhost Desktop % 
    macname@localhost Desktop % ./test.sh
    Start the test script
    macname@localhost Desktop % Start the test script
    Loop #1
    Start the test script
    Loop #1
    Start the test script
    Loop #1
    Loop #2
    Loop #2
    Loop #2
    Loop #3
    Loop #3
    Loop #3
    Loop #4
    Loop #4
    Loop #4
    Loop #5
    Loop #5
    Loop #5
    Test script is complete
    Test script is complete
    Test script is complete
    
    macname@localhost Desktop % 
    macname@localhost Desktop % 

  • 相关阅读:
    删除数据时弹出一个确认对话框
    制作一个页面弹出窗口
    网页授权——扫二维码获取openid
    删除自定义菜单
    创建自定义菜单
    微信公众平台开发接口PHP SDK
    上传文件
    Fibonacci
    最大公约数和最小公倍数
    完数【转载】
  • 原文地址:https://www.cnblogs.com/sea-stream/p/14061493.html
Copyright © 2011-2022 走看看