Python和shell命令

use*_*552 1 python shell

我有下一个python代码:

exec_cmd = "time"
print exec_cmd  
gzip_cmd = subprocess.Popen(exec_cmd, shell=True, stdout=subprocess.PIPE)
out = gzip_cmd.communicate()[0]
print out
Run Code Online (Sandbox Code Playgroud)

当我尝试执行此代码时,我接下来:

time
Usage: time [-apvV] [-f format] [-o file] [--append] [--verbose]
       [--portability] [--format=format] [--output=file] [--version]
       [--quiet] [--help] command [arg...]
Run Code Online (Sandbox Code Playgroud)

但是当我尝试在终端中运行此命令时,我得到了:

time

real    0m0.000s
user    0m0.000s
sys     0m0.000s
Run Code Online (Sandbox Code Playgroud)

那么问题是什么?

Fre*_*Foo 5

"问题"是time内置的Bash,所以它在Bash和/bin/sh(假设它不是Bash的别名 - 它不在Debian/Ubuntu中)之间是不同的.