local tA = {...} local si = tA[1] spawn("lua shell", function() print(pcall(function() os.setenv("sI",si) _ENV = shutil.genenv() coroutine.yield() log(pcall(login)) print(_VERSION) local function shexec(line) local words = {} for w in line:gmatch("%S+") do table.insert(words,w) end if _ENV[words[1]] then local prg = table.remove(words,1) local r={pcall(_ENV[prg],table.unpack(words))} if r[1] == true then table.remove(r,1) end return table.unpack(r) end local pth = os.getenv("PATH") or "." for d in pth:gmatch("[^:]+") do local prg = words[1] _,lex = pcall(fs.exists,d.."/"..prg..".lua") _,nex = pcall(fs.exists,d.."/"..prg) if lex or nex then table.remove(words,1) end if lex then return pcall(loadfile(d.."/"..prg..".lua",table.unpack(words))) elseif nex then return pcall(loadfile(d.."/"..prg,table.unpack(words))) end end if line:sub(1,1) == "=" then line="return "..line:sub(2) end local r={pcall(load(line,"shell","bt",_ENV))} return table.unpack(r) end while true do local didexec = false write((os.getenv("PWD") or "").."> ") local inp=readln() if not inp then break end local rt = {shexec(inp)} if rt[1] == true then table.remove(rt,1) end print(table.unpack(rt)) end end)) end)