How python operates the shell command

  • purpose:

I want to invoke the shell script in python. The shell script has operations to receive input, and I want to enter these commands in python.

description: here is the execution of a .sh shell script, the main function is to have the relevant configuration.

here you need to enter the relevant commands configured by the script, and then execute the logic. How to do it in python?

Mar.03,2021

there are 1531 lines of code in ssr.sh. You need to analyze the case structure after line 1482.

the first command, you choose 1, you will install ShadowsockesR, that is, you will execute the Install_SSR function (in line 670).
then you can write the Install_SSR function into Python commands, or you can decompose these 15 functions into a small script, and then use Python's os.system (cmd) command to call the script.

Menu