Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I Quit IRB from the command line? (Using terminal on mac)

Basically, I'm typing along just fine in terminal, using IRB to run ruby commands:

2.0.0-p0 :014 > bank_account.withdraw(2222)  => -1222  

But sometimes I accidentally miss out a quotation mark.

2.0.0-p0 :020 > BankAccount.create_for("Jim","Johnson) 2.0.0-p0 :021"> bank_account.withdraw(333) 

If you look carefully, you'll see that the speech mark I missed out appears next to the line number on the left, next to the patch version.

From here on in, that speech mark appears everytime I run a command! And it stops the commands working:

2.0.0-p0 :021"> BankAccount.create_for("Julian","Hurley") 2.0.0-p0 :022"> BankAccount.create_for("Katt","Smith") 2.0.0-p0 :023"> exec($0) 

What I want to know is, how do I get rid of that quotation mark? Or quit IRB from the command line in order to reset it?

like image 262
Starkers Avatar asked Mar 29 '13 14:03

Starkers


People also ask

How do I close a command in Terminal Mac?

In the Terminal app on your Mac, choose Terminal > Quit Terminal.

How do I clear the IRB Terminal?

On Mac OS X or Linux you can use Ctrl + L to clear the IRB screen.

How do I use IRB in Terminal?

To access IRB, just type irb in the terminal. IRB allows you to do anything you can do in a Ruby file. For instance, you can do math, get the time by typing Time. now , or print text to the screen.


2 Answers

If you haven't closed a quote, just put a quote in and hit return.

Exiting from the console can be done by typing exit, though in the circumstance your are would need to hit Control - C

like image 166
muttonlamb Avatar answered Oct 10 '22 16:10

muttonlamb


Control - C followed by Control - Z. I hope it helps!

like image 25
S E Avatar answered Oct 10 '22 15:10

S E