What is “sh -c” and what does it do?
Emily Wong
I was checking running processes for a Python script I created and I saw sh -c python Program.py was running.
What is sh -c and what does it do?
1 Answer
Reference: sh -
sh just like bash takes a -c switch followed by a command name, with the intent to execute the command and then exit. The remaining text after -c python (here) are parameters provided to python .
So, this is a way to launch python with an "environment" (as provided by sh), similar to starting python manually from sh .
Environment: man bash enter then type /ENV and enter.
(hit n to see next, and p to se previous instances of ENV in the man page)
More words: