Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
# coding: utf-8
"""
Author : weaming
Created Time : 2019-04-24 12:41:48
"""
import subprocess
import sys
import os
def run_shell(command):
return subprocess.run([os.getenv("SHELL") or "bash", "-c", command]).returncode
def read_lines():
rv = []
for x in sys.stdin:
x = x.rstrip("\n")
x = x.lstrip("$ ")
if x == "DONE":
break
rv.append(x)
return rv
commands = "; ".join(read_lines())
sys.eixt(run_shell(commands))
@weaming

This comment has been minimized.

Copy link
Owner Author

commented Apr 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.