Skip to content

Instantly share code, notes, and snippets.

@willcrichton
Created Aug 30, 2021
Embed
What would you like to do?
#!python3
import sys
import shlex
write = lambda s: sys.stdout.write(s)
cmd = next(sys.stdin).strip()
elems = shlex.split(cmd)
write(elems[0])
write('\n ')
i = 1
while i < len(elems):
write(elems[i])
write(' ')
i += 1
while i < len(elems):
elem = elems[i]
if elem[0] == '-':
write('\n ')
break
write(elem)
write(' ')
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment