If I type ' (single quote, next to the <enter>
button) in the terminal and then press enter it drops to a >
prompt. What exactly is this, what's it used for, and what type of commands can I enter here?
I can <Ctrl-C>
out of it but that's all I got.
A terminal does not only accept one-line code. Actually, you can write code (as bash scripting is a programming language) in multiple lines.
For example, if you write:
it will show exactly the same
>
that showed to your case, as well. It lets you input more commands. Now, if you type in:it will start running your code (which, in this occasion it is simply a while loop that will output a string every 1 second). This allows you to build up small programs without having to write them in one-line code, like this:
which, in this case it isn't such a problem, but it could be, in other occasions (with more code to be written).
So, it is generally used for writing multiple lines of code. In your occasion, the shell recognizes that you don't have an even number of
'
inside your code, and this could not work in any case (the same applies for"
). So, it let's you write more code in order to complete what you've left.For example, if you give as command:
then it will let you continue. And indeed, you can:
It will normally output: