On Friday, April 5, 2002, at 09:29 , Aman Raheja wrote:
> Hi All > Why can't I move to the parent directory using > system "cd .."; > Actually cd command doesn't work at all with system !!! why ? note: 'system' invokes a 'sub shell' - and that sub shell changed directories - while the calling code stayed put. > Though I can do so by > chdir(".."); this does not occur in a sub shell - but in the code itself. > Is there a way to physically move to another dir, for eg. > [aman@aman /usr/home/aman]$./pdir.pl > [aman@aman /usr/home]$ remember the command that you invoke here is running in a sub shell of the login 'command line' shell ... eg: [ /usr/home/bob ]$ cd .. [ /usr/home/ ]$ whereas invoking it in a sub shell ala [jeeves:~] drieux% /bin/sh -c 'cd .. ; pwd' /home [jeeves:~] drieux% pwd /Users/drieux [jeeves:~] drieux% moves the sub_shell, but not the login shell. What you appear to want is something that 'execs' over the current login shell [jeeves:~] drieux% exec /bin/sh -c 'cd .. ; pwd ; sh' /home jeeves% pwd /home jeeves% So try to remember if YOU are moving or your code. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]