From: Vincent Fourmond Date: 2006-12-11T20:22:31+09:00 Subject: Re: Dir.chdir("..") versus `cd ..` P�re No�l wrote: > i discovered this wornig that : > > `cd ..` as no effect but : > > Dir.chdir("..") > > as the right effect, why isn't the first not working ? > > i'm surprised because i'm doing a lot using back quotes ))) When you're using backquotes, Ruby forks a shell and feeds it with the command line given. With `cd ..`, you *do* change the current working directory... for the forked shell. Not for the Ruby program... And the forked shell dies immediately after the command is finished, so no way of doing so. However, if you need to run only one command in another directory, you might try: `cd ..; a_nice_command` Cheers, Vince -- Vincent Fourmond, PhD student http://vincent.fourmond.neuf.fr/