[Python] Change working directory in shell with a python script

Discussão em 'Python' iniciado por Stack, Março 7, 2025.

  1. Stack

    Stack Membro Participativo

    I want to implement a userland command that will take one of its arguments (path) and change the directory to that dir. After the program completion I would like the shell to be in that directory. So I want to implement cd command, but with external program.

    Can it be done in a python script or I have to write bash wrapper?

    Example:

    tdi@bayes:/home/$>python cd.py tdi
    tdi@bayes:/home/tdi$>

    Continue reading...

Compartilhe esta Página