zoukankan      html  css  js  c++  java
  • Linux sleep命令 和 wait命令

    man sleep:

    SLEEP(1)                         User Commands                        SLEEP(1)
    
    NAME
           sleep - delay for a specified amount of time
    
    SYNOPSIS
           sleep NUMBER[SUFFIX]...
           sleep OPTION
    
    DESCRIPTION
           Pause for NUMBER seconds.  SUFFIX may be `s' for seconds (the default),
           `m' for minutes, `h' for hours or `d' for days.  Unlike most  implemen‐
           tations  that require NUMBER be an integer, here NUMBER may be an arbi‐
           trary floating point number.  Given two or more  arguments,  pause  for
           the amount of time specified by the sum of their values.
    
           --help display this help and exit
    
           --version
                  output version information and exit

    sleep 1    睡眠1秒
    sleep 1s    睡眠1秒
    sleep 1m   睡眠1分
    sleep 1h   睡眠1小时

    等待进程完成(wait命令)

    格式:    wait  [n]

    Shell本身(不通过创建新进程的方法)执行wait,等待进程号为n的后台进程终止,并报告它的终止状态。如默认参数n,则等待Shell上所有当前活动的后台进程终止,并返回代码0。

          wait 命令 保证进程同步 等待一个子进程结束 多个并发就用多个wait
    例如:       #!/bin/sh
                  echo “1”
                  sleep 5&
                  echo “3”
                  echo “4”
                  wait
                  echo”5”

    深入:

    http://www.linuxidc.com/Linux/2011-03/33918.htm

  • 相关阅读:
    Linux下pip3安装问题
    客户信息维护jsp
    Java开发环境搭建
    软件开发一般步骤
    PM
    需求分析
    结对编程
    GUI
    spring boot 整合cfx,axis2创建webservice客户端
    webserver 返回json 如何去掉 <string xmlns="http://tempuri.org/">
  • 原文地址:https://www.cnblogs.com/youxin/p/3546510.html
Copyright © 2011-2022 走看看