This is a FAQ:
perldoc -q directoryI {changed directory, modified my environment} in a perl script. How come the change disappeared when I exited the script? How do I get my changes to be visible?
In the strictest sense, it can't be done--the script executes as a different process from the shell it was started from. Changes to a process are not reflected in its parent--only in any children created after the change. There is shell magic that may allow you to fake it by eval()ing the script's output in your shell; check out the comp.unix.questions FAQ for details.
In principle, changing the enclosing shell is workable, if your program outputs a new shell script, which the enclosing shell executes:
#!/usr/bin/ksh echo "Doing what the Perl script tells me" $(perl-script.pl)
#!/usr/bin/perl -w print 'cd ~';
In reply to Re: How to change Current Shell's Pwd ?
by Corion
in thread How to change Current Shell's Pwd ?
by perl_lover
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |