Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- puts "Where to explore?"
- print "> "; $command = gets.chomp #cd so program knows we are changing directories
- $command.gsub!("cd ","") #REMOVE cd and a space because appropriate input would be "cd c:\example"
- if Dir.exists?($command) # METHOD CDTODIR02 #
- Dir.chdir($command); puts "\n"
- elsif File.file?($command)
- $command = File.dirname $command
- Dir.chdir($command); puts "\n"
- elsif not Dir.exists?($command)
- puts "#{$command} not found."
- else # ELSE CDTODIR02 #
- puts "An unknown error occurred, please check your input."
- puts "#{$command} not recognized."
- end # METHOD CDTODIR02 #
Advertisement
Add Comment
Please, Sign In to add comment