RE: system ("cd ..")
- From: Bob_Showalter@xxxxxxxxxxxxxxx (Bob Showalter)
- Date: Mon, 29 Aug 2005 09:14:35 -0400
Eliyah Kilada wrote:
> Hi,
> It seems that the following code gives unexpected results:
>
> system ("cd $dir_name");
> system ("pwd");
> ---> this prints the old directory name not the new one. In other
> words, the previous (cd) command hasn't taken its effect!
> Do anyone know why?
Each call to system() creates a separate process in which the command is
executed. The cd command only affects that separate process.
You need to use Perl's chdir() function to change the working directory for
the current process.
.
- Follow-Ups:
- Re: system ("cd ..")
- From: Eliyah Kilada
- Re: system ("cd ..")
- Prev by Date: RE: Date in perl
- Next by Date: RE: How check DBI version on the server?
- Previous by thread: edit / seek woes
- Next by thread: Re: system ("cd ..")
- Index(es):
Relevant Pages
|