开发者

LoadError: no such file to load — curl

I just have a problem with a ruby script

I just want to change the directory 开发者_StackOverflow中文版where the following command would be executed

I try this code but it didn't work

  puts "Nom du dossier svn?"
  @dossier = gets.chomp
  system("cd #{@dossier}")

(it's in french because i'm french ^^)

Someone can help me ?

Thank you


Use the Dir.chdir function.

When you do:

system("cd dir")

This in effect starts a shell, that shell changes to the given directory and promptly exits. It has no effect whatsoever on the calling process (your ruby script).


system spawn a subshell, that is this subshell that will change directory, then die.

You want your actual Ruby process to change directory, so use Dir.chdir(@dossier)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜