⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timeout2

📁 android-w.song.android.widget
💻
字号:
#!/bin/sh# Author: P@draigBrady.com# V1.0  : Nov  3 2006##  Execute a command with a timeout.#  If the timeout occurs the exit status is 128##  Note there is an asynchronous equivalent of this#  script packaged with bash (under /usr/share/doc/ in my distro),#  which I only noticed after writing this.if [ "$#" -lt "2" ]; then    echo "Usage:   `basename $0` timeout_in_seconds command" >&2    echo "Example: `basename $0` 2 sleep 3 || echo timeout" >&2    exit 1ficleanup(){    kill %1 2>/dev/null             #kill sleep $timeout if running    kill %2 2>/dev/null && exit 128 #kill monitored job if running}set -m               #enable job controltrap "cleanup" 17    #cleanup after timeout or commandtimeout=$1 && shift  #first param is timeout in secondssleep $timeout&      #start the timeout"$@"                 #start the job

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -