how can I implement "cd" like shell in Python?

Laurent Pointal laurent.pointal at free.fr
Thu Jun 28 13:13:21 EDT 2012


Sergi Pasoev wrote:

> Do you mean to implement the cd command ? To what extent do you want to
> implement it ? if what you want is just to have a script to change the
> current working directory, it is as easy as this:
> 
> 
> import sys
> import os
> os.chdir(sys.argv[1])
> 
> plus you could add some error-handling code.

To have a shell / python script interaction for cwd management, you can take 
a look at autojump

	https://github.com/joelthelion/autojump/wiki

Its a Python script + different shells glue.

A+
Laurent.


-- 
Laurent POINTAL - laurent.pointal at laposte.net




More information about the Python-list mailing list