3 ms·
"echo" and "time" are explicitly bash built-ins, "which" and "cat" are not, and you will always get a process spawned there. Your second strace is misleading,
by steerablesafe 5y ago
"echo" and "time" are explicitly bash built-ins, "which" and "cat" are not, and you will always get a process spawned there.
Your second strace is misleading, you didn't trace child processes.
$ strace bash -c '$(which echo) hi' 2>&1 | grep 'exec'
execve("/bin/bash", ["bash", "-c", "$(which echo) hi"], 0x7ffddfcdaee0 /* 59 vars */) = 0
execve("/bin/echo", ["/bin/echo", "hi"], 0x55eb565cb0b0 /* 59 vars */) = 0
$ strace -f bash -c '$(which echo) hi' 2>&1 | grep 'exec'
execve("/bin/bash", ["bash", "-c", "$(which echo) hi"], 0x7ffd09b3e228 /* 59 vars */) = 0
[pid 81493] execve("/usr/bin/which", ["which", "echo"], 0x5560d172e0b0 /* 59 vars */) = 0
execve("/bin/echo", ["/bin/echo", "hi"], 0x5560d172e0b0 /* 59 vars */) = 0