Skip to content

Instantly share code, notes, and snippets.

@bbot
Last active December 28, 2015 20:19
Show Gist options
  • Save bbot/7556441 to your computer and use it in GitHub Desktop.
Save bbot/7556441 to your computer and use it in GitHub Desktop.
Modern computing
import os
sudoPassword = 'hunter2'
foobar = 'you should see this line \\"second\\"'
command = 'echo %s %s' % (sudoPassword, foobar)
def blah(input):
os.system('echo %s|sudo -S %s' % (sudoPassword, command))
blah(1)
"""
% python foobar.py
hunter2 you should see this line "second"
""""
@bbot
Copy link
Author

bbot commented Nov 20, 2013

Line 4: This is what you have to do if you want to get a double quote intact through the multiple layers of text parsers between python source and terminal output.

@MichealRein
Copy link

Ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment