我想知道在 nohup 中运行一些东西需要多少时间。我知道这有效:
$ time sleep 2
real 0m2.001s
user 0m0.000s
sys 0m0.001s
Run Code Online (Sandbox Code Playgroud)
但是为什么它不适用于 nohup?
$ nohup time sleep 2 &
[1] 29456
$ nohup: ignoring input and appending output to 'nohup.out'
nohup: failed to run command 'time': No such file or directory
[1]+ Exit 127 nohup time sleep 2
Run Code Online (Sandbox Code Playgroud)
jor*_*anm 30
它不起作用,因为time是 shell 关键字。有外部time二进制文件,但您似乎没有安装。这可能会起作用:
nohup bash -c 'time sleep 2'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12743 次 |
| 最近记录: |