def do_cd(self, arg):
        """Imitates the bash shell 'cd' command."""
        from os import chdir, path
        fullpath = path.abspath(path.expanduser(arg))
        if path.isdir(fullpath):
            chdir(fullpath)
        else:
            msg.err("'{}' is not a valid directory.".format(arg))
def do_cd ( self , arg ) : from os import chdir , path fullpath = path . abspath ( path . expanduser ( arg ) ) if path . isdir ( fullpath ) : chdir ( fullpath ) else : msg . err ( "'{}' is not a valid directory." . format ( arg ) )
Imitates the bash shell 'cd' command.