为什么我不能在详细模式下使用 time 命令而不指定整个命令路径?

mat*_*sco 2 time

鉴于...

~$ which time
time is a shell keyword
time is /usr/bin/time
Run Code Online (Sandbox Code Playgroud)

为什么这有效?

~$ /usr/bin/time --verbose ./some_script.sh 
Command being timed: "./some_script.sh"
User time (seconds): 0.00
System time (seconds): 0.01
Percent of CPU this job got: 51%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.03
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 4572
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 1
Minor (reclaiming a frame) page faults: 1548
Voluntary context switches: 3
Involuntary context switches: 7
Swaps: 0
File system inputs: 48
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Run Code Online (Sandbox Code Playgroud)

为什么这不呢?

~$ time --verbose ./some_script.sh 
--verbose: no se encontró la orden

real    0m0.124s
user    0m0.101s
sys 0m0.022s
Run Code Online (Sandbox Code Playgroud)

cuo*_*glm 8

当您在不指定路径的情况下调用命令时,将调用具有相同名称的其他 shell 别名、函数、内置函数,而不是命令。此行为由 POSIX 定义

为了调用外部time命令,您可以使用command

command time --verbose cmd
Run Code Online (Sandbox Code Playgroud)