其他分享
首页 > 其他分享> > wait 命令

wait 命令

作者:互联网

wait命令:
 
    概念:阻塞当前进程的执行,直到指定的子进程结束后,当前线程才会继续执行。
 
    格式:wait [进程号]
 
    常用:wait
        在shell中直接使用wait:    等待所有的子进程结束后,当前进程才继续往下走。
        在函数中使用wait:        只等待函数中启动的后台子进程。
 
    举例:
        #!/usr/bin/env bash
 
        for file in $(ls /home/work/jxn/test);
        do
            {
              cp /home/work/jxn/test/$file /home/work/jxn/bak
            }&
        done
 
        # 等待所有的子进程都执行完成后,当前线程才继续往下执行。
        wait
 
        echo "finish"
 

 

TRANSLATE with x English
Arabic Hebrew Polish
Bulgarian Hindi Portuguese
Catalan Hmong Daw Romanian
Chinese Simplified Hungarian Russian
Chinese Traditional Indonesian Slovak
Czech Italian Slovenian
Danish Japanese Spanish
Dutch Klingon Swedish
English Korean Thai
Estonian Latvian Turkish
Finnish Lithuanian Ukrainian
French Malay Urdu
German Maltese Vietnamese
Greek Norwegian Welsh
Haitian Creole Persian  
  TRANSLATE with COPY THE URL BELOW Back EMBED THE SNIPPET BELOW IN YOUR SITE Enable collaborative features and customize widget: Bing Webmaster Portal Back

标签:work,命令,location,进程,home,document,wait
来源: https://www.cnblogs.com/gaoyuechen/p/16527493.html