On 2016-10-31, Wildman via Python-list <python-list@python.org> wrote: > On Mon, 31 Oct 2016 15:44:13 +1100, Ben Finney wrote: >> Wildman via Python-list <python-list@python.org> 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 specific Bash features. So this is >> asking rather to invoke a shell command.
Actually it's not a shell command either. > Yes, I know. I perhaps should have used the word "shell" instead > of bash. However, bash is a shell. To most people, "bash command" or "shell command" refers to 1) a commands built in to bash (or other shell) or 2) a command line that must be interpreted by bash (or other shell) because it uses I/O redirection, variable substituion, globbing, etc. Your code does not use bash (or any other shell), nor does it need to. It's just running the sudo executable. There are no shells involved, so using the word shell isn't any better than using the word bash. -- Grant Edwards grant.b.edwards Yow! I have seen these EGG at EXTENDERS in my Supermarket gmail.com ... I have read the INSTRUCTIONS ... -- https://mail.python.org/mailman/listinfo/python-list