0

I stumbled across this by accident, and was wondering what it meant. What I did was I was typing

adb logcat

but accidentally typed

adb logcat'

and I was greeted to this:

enter image description here

I Control-C'd out of it, and tried it again with using ls, cd, lots of commands, same result for each.

2 Answers 2

2

Single quote starts a string, which may include newlines. Close it with another single quote and see what the command you entered does with the string. In most cases it will emit some sort of error, like "file not found" since it's rare to find a file with an embedded newline in its name.

2
  • so basically, if I were to add another single quote after the >, then it would run adb logcat with an empty string?
    – Jeeter
    Jul 28, 2015 at 21:06
  • Not quite. It would run adb "logcat\n" and adb would complain that it didn't recognize the command "logcat\n" - ie. "logcat" with a newline character appended. Jul 29, 2015 at 13:08
1

It was waiting for you to finished the quote. If you type another ' it will complete the quote. You could then try the Home key or Control-A and see if lets you edit the line.

The quotes can be useful when need to give names the shell will try to use, such as:

touch 'Hello There'

Will create a file named "Hello There". Without the ' it will create two files, named Hello and There. It is different than using the " character as:

touch '$HELLO THERE'

Will create a file named "$HELLO THERE", but:

touch "$HELLO THERE"

Will create a file named "THERE" and a file name after the contents of the shell variable $HELLO [assuming it exists].

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .