Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

What is “sh -c” and what does it do?

Writer 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?

4

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:

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy