Programmatically change the shell's cwd in a portable way

前端 未结 4 1820
旧时难觅i
旧时难觅i 2021-01-21 04:44

I\'d like to write a command line tool in C that acts as an advanced \"cd\" or \"pushd/popd\" command that can be ported to Windows/Mac/Linux. (Full details, in case you are cur

4条回答
  •  情书的邮戳
    2021-01-21 05:12

    $(echo "cd /foo/bar")
    

    That demonstrates how you might do such a thing with a POSIX shell. It's not portable with the Windows shell, of course.

提交回复
热议问题