Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81567
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <random832@fastmail.us> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'sys': 0.07; 'executed': 0.09; 'parsing': 0.09; 'received:internal': 0.09; 'skip:/ 10': 0.09; 'works.': 0.09; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'sees': 0.16; 'sudo': 0.16; 'language': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'trying': 0.19; 'command': 0.22; 'import': 0.22; 'shell': 0.22; 'errors.': 0.24; 'instance,': 0.24; 'passes': 0.24; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; "skip:' 10": 0.31; 'quotes': 0.31; 'handled': 0.32; 'received:66': 0.35; 'case,': 0.35; 'received:10': 0.37; 'nov': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'from:no real name:2**0': 0.61; 'simple': 0.61; 'first': 0.61; 'header:Message-Id:1': 0.63; '26,': 0.68; '2014,': 0.84; 'recover': 0.91; 'imagine': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=mesmtp; bh=IL+vaEzzPsZoryOwNqwIqJb0TNs=; b=Z4arQ9 UDcqZzI6Qip+BJlATljF5sAcXwP5Y3XHRUciNLjuXknzjjX52XiBhYRoQlUhp6l3 eK67pbBV0KBUhiK+vdcAgGENGCUassvks7Jw4BlGsrEHWTjKOAF5uzokKBByf+nZ NzDecs7ui4t53fKbx31Q/nr6Bkgd/MzzoxGkA= |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:subject :date:in-reply-to:references; s=smtpout; bh=IL+vaEzzPsZoryOwNqwI qJb0TNs=; b=F/Wj5IXZ0nvNtDZyq5jsjxWVgYhstt+jJL6JTH9loiR2Bubi/Z7b wsQwUQoc8kvlMCHwgmwwOMEm+NMUUCHCQFHckpMGYLgkRHgfmqJUxKNsGYYQlUA3 doFo1Ew2tsJFoxUOs8eiD/qXGl+kthKVJfi40Sq2qBDloaYUQqQQSnE= |
| X-Sasl-Enc | f/ZbBnPq+9+mKVuk2mvTIVLFyjaCBYF2beaVWKPdpQNx 1417011145 |
| From | random832@fastmail.us |
| To | python-list@python.org |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | 7bit |
| Content-Type | text/plain |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-53201334 |
| Subject | Re: Quotation Ugliness |
| Date | Wed, 26 Nov 2014 09:12:25 -0500 |
| In-Reply-To | <54756D5F.4040806@tundraware.com> |
| References | <grifkb-kpo1.ln1@ozzie.tundraware.com> <mailman.16304.1416966896.18130.python-list@python.org> <54756D5F.4040806@tundraware.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16322.1417011148.18130.python-list@python.org> (permalink) |
| Lines | 37 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417011148 news.xs4all.nl 2954 [2001:888:2000:d::a6]:40235 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81567 |
Show key headers only | View raw
On Wed, Nov 26, 2014, at 01:04, Tim Daneliuk wrote:
> In this case, I am not trying to write a fullblown language or recover
> from syntax errors. Here's a usecase - I want to know whether I need
> to use a sudo password when the user passes a command on the command line
> of a program:
>
> someprog.py uname && sudo cat /etc/sudoers
>
> vs.
>
> someprog.py uname && echo "sudo cat /etc/suoders"
>
>
> In the first instance, I need the sudo passoword, in the second I don't.
I think first you need to understand how the command line works. Much of
this parsing - including both && and quotes - is handled by the shell
before your program ever sees it.
Imagine someprog.py is this very simple program:
import sys
print("%r" % (sys.argv,))
$ someprog.py uname
['someprog.py', 'uname']
$ someprog.py uname && sudo cat /etc/sudoers
['someprog.py', 'uname']
Password: {sudo executed independent of your program}
$ someprog.py uname && echo "sudo cat /etc/sudoers"
['someprog.py', 'uname']
sudo cat /etc/sudoers {echo executed independent of your program}
$ someprog.py uname "&&" sudo cat /etc/sudoers
['someprog.py', 'uname', '&&', 'sudo', 'cat', '/etc/sudoers']
$ someprog.py uname "&&" echo "sudo cat /etc/sudoers"
['someprog.py', 'uname', '&&', 'echo', 'sudo cat /etc/sudoers']
$ someprog.py 'uname && echo "sudo cat /etc/sudoers"'
['someprog.py', 'uname && echo "sudo cat /etc/sudoers"']
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 18:18 -0600
Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-25 18:40 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 19:18 -0600
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-26 12:32 +1100
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:00 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:00 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 19:18 -0600
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-26 11:44 +1100
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 19:20 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-25 19:20 -0600
Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-25 19:44 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:01 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:01 -0600
Re: Quotation Ugliness Ben Finney <ben+python@benfinney.id.au> - 2014-11-26 12:54 +1100
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:04 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 00:04 -0600
Using a password with ‘sudo’ (was: Quotation Ugliness) Ben Finney <ben+python@benfinney.id.au> - 2014-11-26 18:02 +1100
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-26 18:10 +1100
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 08:59 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 08:59 -0600
Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-26 06:56 -0600
Re: Quotation Ugliness Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-11-26 15:45 +0200
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 01:37 +1100
Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-26 08:26 -0600
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:07 +1100
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:09 +1100
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:36 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:36 -0600
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:48 +1100
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:55 -0600
Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 11:00 -0500
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:02 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:02 -0600
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 03:13 +1100
Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 11:16 -0500
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:54 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:54 -0600
Re: Quotation Ugliness alister <alister.nospam.ware@ntlworld.com> - 2014-11-26 16:45 +0000
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 10:54 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:55 -0600
Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 10:53 -0500
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 08:58 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 08:58 -0600
Re: Quotation Ugliness Chris Angelico <rosuav@gmail.com> - 2014-11-27 02:06 +1100
Re: Quotation Ugliness Tim Chase <python.list@tim.thechases.com> - 2014-11-26 09:23 -0600
Re: Quotation Ugliness Ben Finney <ben+python@benfinney.id.au> - 2014-11-27 07:24 +1100
Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 09:12 -0500
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:02 -0600
Re: Quotation Ugliness Tim Daneliuk <tundra@tundraware.com> - 2014-11-26 09:02 -0600
Re: Quotation Ugliness random832@fastmail.us - 2014-11-26 10:16 -0500
csiph-web