#!/usr/bin/env python3 import os import re import argparse class EOFException(Exception): pass class Instruction(): def __init__(self, string: str): # TODO handle quoting and escapments keywords = string.split() self.prog = keywords[0] self.arguments = keywords[1:] def execute(self): cpid = os.fork() if cpid == 0: os.execvp(self.prog, [self.prog] + self.arguments) else: os.waitpid(cpid, 0) def read_instruction(fh): # TODO We should be reading an instruction, not a line. while True: line = fh.readline() if line == "": raise EOFException() line = line.strip() # We ignore empty lines and lines which start with # if not line.startswith("#") and not line == "": break return Instruction(line) def main(arguments): for script in arguments["