Skip to content

Instantly share code, notes, and snippets.

@m13253
Created December 30, 2014 14:03
Show Gist options
  • Select an option

  • Save m13253/8d8ce9347a56a030c7a5 to your computer and use it in GitHub Desktop.

Select an option

Save m13253/8d8ce9347a56a030c7a5 to your computer and use it in GitHub Desktop.
A script which dumps the command line passed to it
#!/usr/bin/env python
'''Dump the command line passed to it'''
import sys
def quote_argv(argv):
for i in argv:
apos = ' ' in i or '\\' in i
yield "'"+i.replace("'", "'\\''")+"'" if apos else i.replace("'", "\\'")
def main():
print(' '.join(quote_argv(sys.argv)))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment