On Wednesday 24 August 2005 04:26 pm, Amir Karger wrote:

> Several people pointed out that I didn't perldoc -f system. Sorry!
> Btw, even after reading the docs, I still don't understand why Perl
> would pass a cd command to a piece of the shell that can't understand
> it. Granted, I shouldn't do it anyway, because then Perl will exit the
> shell it created for the system() and my cd will be useless.

It's not "a piece of the shell"; it's no shell at all. Perl is trying to 
execute /bin/cd (or rather, 'cd' somewhere in your search path), as provided 
for by execvp. As to why perl does it; perl doesn't know or care that the 
thing you're naming is a shell builtin; it simply tries to run what you told 
it to. If you wanted to force it to work as a builtin, you could use 
system('sh', '-c', 'cd /foo'); -- but as you've already noted, it wouldn't be 
good for anything anyway.


Andrew

Reply via email to