How to force os.system() to use bash instead of shell

前端 未结 5 730
轮回少年
轮回少年 2020-12-17 23:22

I\'ve tried what\'s told in How to force /bin/bash interpreter for oneliners

By doing

os.system(\'GREPDB=\"my command\"\')
os.system(\'/bin/bash -c          


        
5条回答
  •  遥遥无期
    2020-12-18 00:06

    The solution below still initially invokes a shell, but it switches to bash for the command you are trying to execute:

    os.system('/bin/bash -c "echo hello world"')
    

提交回复
热议问题