CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
change directory when exiting perl

 



BTeal
New User

Jan 19, 2010, 6:53 AM

Post #1 of 2 (537 views)
change directory when exiting perl Can't Post

I have written a perl script to navigate a UNIX file system. When the script exits you are left in the directory you started the script in. I would like to have the script leave me in the directory I navigate to when exiting. Any suggestions?


shawnhcorey
Enthusiast


Jan 19, 2010, 11:09 AM

Post #2 of 2 (532 views)
Re: [BTeal] change directory when exiting perl [In reply to] Can't Post

In UNIX, each process is forked from their parent and inherits their environment. After that, they are independent. Any changes in either does not effect the other. To get a child process to run in the parent, you must . or source it. See `man bash` and search for /source/

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives