S
Steven D'Aprano
hi all,
can any linux command be invoked/ executed without using shell (bash) ?
py> import os
py> status = os.system("ls")
Prints the output of ls and stores the exit code into status.
py> file_list = os.popen("ls").read()
Stores the output of ls into file_list.
Or see the module "commands".
what abt security concerns ?
Yes, there are serious security concerns. You should be *very* careful
about executing strings generated by users. You probably don't want your
program executing something like os.system("rm -rf /").