see what directory I am in (PWD) in ruby

-1

I am learning ruby, so I am doing several programs that I had already done in python to practice the language (because I can not think of many things I can do, if someone comes up with a ruby programming exercise please write in the comments.) At the moment I am recreating a project that was a bash emulator in windows, for that I have to put a prompt that has the directory in which the user is.

How can I find out what directory I'm in using ruby?

    
asked by binario_newbie 10.07.2018 в 05:41
source

1 answer

1

For the absolute path :

Dir.pwd

For the path relative to the script that is being executed:

__dir__
    
answered by 10.07.2018 / 14:57
source