ganilmohan has asked for the wisdom of the Perl Monks concerning the following question:

Hi, the following command returns nothing
system("cd /usr/anil/EBus-8.5.3/");
Actually I want to change my directory to "/usr/anil/EBus-8.5.3/" but this never changes my directory. I'm where I'm. Help!

Replies are listed 'Best First'.
Re: Change Directory.
by Corion (Patriarch) on Aug 07, 2008 at 10:17 UTC

    See chdir. What you are doing is changing the directory for the subshell. At the end of the system() call, the subshell exits and the current directory for your application remains unchanged.

Re: Change Directory.
by marto (Cardinal) on Aug 07, 2008 at 10:17 UTC
    Perhaps you want to look at using chdir. In answers to your previous posts people have pointed you towards http://perldoc.perl.org, perhaps you would benefit from spending some time reading up on some of the basics. There is also the tutorials section of this site, which has plenty of good resources.

    Hope this helps

    Martin
      Maybe, in addition to perldoc (which, to be fair, isn't the most rivetting read), he ought to consider investing in a copy of Learning Perl &/or Programming Perl &/or Perl In A Nutshell ??

      .oO(Crackin' good book, that last one)

      A user level that continues to overstate my experience :-))
Re: Change Directory.
by jdporter (Paladin) on Aug 07, 2008 at 13:52 UTC
Re: Change Directory.
by actualize (Monk) on Aug 07, 2008 at 15:37 UTC

    What are you trying to do with your program? You should probably avoid using system. I mean, if you are going to use perl, why program in shell?

    -Actualize