【发布时间】:2017-04-02 05:35:39
【问题描述】:
你如何检测os.system 会调用什么shell?
我不确定os.name 或sys.platform 是否可以工作,因为系统可能被配置为使用非标准外壳,例如Windows 上的cygwin 外壳。
如果我的脚本要在 windows 和 linux 上运行,我需要知道系统使用的 shell 以了解构建命令的语法
【问题讨论】:
-
如果我的问题没问题,也许这会有所帮助:stackoverflow.com/a/1492667/5386668
-
@GurupadHegde 我不确定它是否与该问题重复,因为该问题询问如何从脚本中检索脚本的父 shell,该问题询问如何查找 shell 是什么在执行 os.system() 时被调用,那么如何找到 child-shell
标签: python shell cross-platform system-calls platform