#version 1.2.6 """ instructions supportees : cd,cat,mv,mkdir,rm,rmdir,touch,pwd,ls,python,clear,su """ """ import time as t tD=t.monotonic() """ print("Initialising file system...") from FS import * """import gc print("Memory free :",gc.mem_free()) print("Optimising memory...") gc.collect() print("Memory free :",gc.mem_free()) print("Ready ! ("+str(round(t.monotonic()-tD,1)),"seconds setup)") del gc,t,tD """ #definitions de variables du terminal user="user" #definitions de commandes du terminal def python(name=""): import sys l=sys.implementation l2=[] for i in l[1]: l2.append(str(i)) print(l[0],"version",".".join(l2)) print("Type exit() to quit.") return "python" def clear(): import sys for i in range(5): print("\n") for i in range(10): sys.stdout.write("\b"*32) def exit(): def terminal(line): line=line.split() if line!=[]: instruction=line[0]+"(" cmd=line[0] del line[0] if line!=[]: instruction+="'"+"','".join(line)+"')" else: instruction+=")" try: return eval(instruction) except NameError: print("bash:",cmd,"\b: command not found") #except: print("bash: error") while True: wd=str("/"+"/".join(fswd)) wd=wd[0:5].replace("/root","~")+wd[6:len(wd)] line=input(str(user)+"-"+wd+chr(36)+" ") retour=terminal(line) if retour=="python": break print("\nWelcome on Linux terminal \nemulator :\n") exit()