Changing directory with a twist

Oleg Broytmann phd at
Tue Mar 14 17:59:12 CET 2000

On Tue, 14 Mar 2000, Gaetan Corneau wrote:
> >    What OS? UNIX?
> Sorry: NT and Linux

   Don't know anything about NT. On UNIX (Linux is UN*X too) you need to
pass the name of directory back to shell, and the shell have to be prepared
to get the name and chdir. Example:

in shell:
eval cd "``"
         ^         ^ these are backticks, not apostrophs

print "/usr/local/etc"

   Please note - I am paranoid sysadmin :) so:

1) I do not recommend eval `` - if returns a trojan
shell script you'll be in trouble;

2) I do recomment to wrap the result in double quotes - to pass the output
to cd as 1 parameter, thus you can return a directory name with spaces;
anyway I do not recomment have directory names with special character -
they may be evaluated by eval.

    Oleg Broytmann      Foundation for Effective Policies      phd at
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-list mailing list