Re: Call a shell command from Python (was: Calling Bash Command From Python)

2016-10-31 Thread Grant Edwards
On 2016-10-31, Wildman via Python-list wrote: > On Mon, 31 Oct 2016 15:44:13 +1100, Ben Finney wrote: >> Wildman via Python-list writes: >> >>> Python 2.7.9 on Linux >>> >>> Here is a bash command that I want to run from a python >>> program: sudo grep "^user\:" /etc/shadow >> >> Some points t

Re: Call a shell command from Python (was: Calling Bash Command From Python)

2016-10-31 Thread Wildman via Python-list
On Mon, 31 Oct 2016 15:44:13 +1100, Ben Finney wrote: > Wildman via Python-list writes: > >> Python 2.7.9 on Linux >> >> Here is a bash command that I want to run from a python >> program: sudo grep "^user\:" /etc/shadow > > Some points to note: > > * Those commands are not special to Bash, o

Re: Call a shell command from Python (was: Calling Bash Command From Python)

2016-10-30 Thread Chris Angelico
On Mon, Oct 31, 2016 at 3:44 PM, Ben Finney wrote: > Note that ‘sudo’ is specifically designed to be invoked interactively, > seeking to verify that the current user has credentials to run the > command. > > Note further that ‘sudo’ will record when the *current user session* > last invoked ‘sudo’

Call a shell command from Python (was: Calling Bash Command From Python)

2016-10-30 Thread Ben Finney
Wildman via Python-list writes: > Python 2.7.9 on Linux > > Here is a bash command that I want to run from a python > program: sudo grep "^user\:" /etc/shadow Some points to note: * Those commands are not special to Bash, or any particular shell. They invoke commands, without AFAIK any speci