1

I opened Linux Terminal and entered echo I can't hear you. I expected the next line to print "I can't hear you," but instead it printed >. I think it had something to do with the apostrophe, but now I cannot enter any new commands. No matter what I try to enter after this, the next line always begins with >. I'm not sure if there's a specific term for this situation or how to get out of it. I lack the technical terminology to describe this problem and cannot tell if anyone else has asked this question before.

Aven Desta
  • 2,114
  • 12
  • 27
K Man
  • 602
  • 2
  • 9
  • 21
  • Does this answer your question? [I want to embed a single quote in a string](https://stackoverflow.com/questions/38602752/i-want-to-embed-a-single-quote-in-a-string) – tink Feb 19 '21 at 16:56

2 Answers2

3

You need to leave the terminal with Ctrl + C or Ctrl + D. This is caused because you did not close the opened quote. You can also type a closing quote to exit the >.

enter image description here

The arrow > means, terminal is waiting for you to close the opened quote.

If you want to use a quote in your echo, you can escape it with backslash

echo Trump\'s Tower

You can read This for more info.

Aven Desta
  • 2,114
  • 12
  • 27
1

Using Ctrl + c or Ctrl + d will get you out. The echo command can handle any number of words with regular letters and numbers (A-Z, a-z, 0-9). You can avoid the problem of getting stuck by using quotes. Double quotes or single quotes will both work, but there are differences to note.

# Double quotes: this works well since it uses a different quote type so the ' is okay
echo "Hello World's"

# Single quotes: this will cause the same problem because there is an unpaired quote 
echo 'Hello World's'
DieOde
  • 61
  • 4