@@ -0,0 +1,1054 @@
+# -*- coding: utf-8 -*-%0A%0Aimport sys%0Aimport os%0Aimport re%0Aimport subprocess%0A%0Ahistories = %5B%5D%0A%0Adef history(str=None):%0A    for index, line in enumerate(histories):%0A        sys.stdout.write(%22%252d %25s%5Cn%22 %25 (index, line))%0A%0Apattern = re.compile(r'%5C~') %0Ainner_func = %7B%0A    %22cd%22: os.chdir,%0A    %22exit%22: sys.exit,%0A    %22history%22: history%0A%7D%0A%0Awhile(True): %0A    print %22%5Cnmysh%3E %22,%0A    line = sys.stdin.readline().strip()%0A    if (len(line) == 0):%0A        continue%0A%0A    commands = line.split()%0A    command = commands%5B0%5D%0A    if (inner_func.has_key(command)):%0A        temp_arg = %22%22%0A        if (len(commands) %3E 1):%0A            temp_arg = commands%5B1%5D%0A        if (%22/%22 in temp_arg):%0A            temp_arg = os.getcwd() + %22/%22 + temp_arg%0A        temp_arg = re.sub(pattern, os.environ%5B'HOME'%5D, temp_arg)%0A        histories.append(line)%0A        inner_func%5Bcommand%5D(temp_arg)%0A    else:%0A        try:%0A            ret = subprocess.call(line, shell=True)%0A            if (ret == 0):%0A                histories.append(line)%0A        except Exception as (errorno, e):%0A            print e, commands%0A

Add mysh.py