One solution is to pass the information to the parent and let it change the path.
Unix, single command:
chdir `perl -e 'print quotemeta("/some/path")'`
Unix, multiple commands:
$ cat script.pl print("set var=val\n"); print("set foo=bar\n"); print("cd /some/path\n"); $ script.pl > temp_file && source temp_file && rm temp_file
I'm sure it can be done without a temp file, but my sh scripting is rusty.
Windows, multiple commands:
>type script.pl print("set var=val\n"); print("set foo=bar\n"); print("cd \\some\\path\n"); >for /f "usebackq delims=" %%f in (`script.pl`) do %%f
In reply to Re^2: chdir not working
by ikegami
in thread chdir not working
by amitrajvarma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |