13

I accidentaly typed ls' and I got a interactive interface: > What is this?

I tried search on internet, found nothing.

0

3 Answers 3

34

This behavior is distro agnostic. You had open a quote, the shell is displaying $PS2 global variable ($PS2 is the > in your output) while the second quote is missing.

You can change PS2 with what you want instead :

Ex: export PS2=">>>"

The value of $PS2 is printed (after expansion) as the secondary prompt for more data when bash is running interactive. See man bash, under PROMPTING.

6
  • 2
    You have good eyes to spot the stray single quote.
    – mu is too short
    Mar 13, 2012 at 5:39
  • 1
    Added info: To get out, just enter another single quote, or press ctrl-c.
    – octern
    Mar 13, 2012 at 5:41
  • Not exactly reading stdin; you can enter a multi-line quote in a script or something just as well; but the secondary prompt is displayed in an interactive session when you enter a newline inside a quoted string, an unfinished loop, etc.
    – tripleee
    Mar 13, 2012 at 5:43
  • 1
    Better use ctrl-d instead of ctrl-c as EOF (End Of File) Mar 13, 2012 at 5:44
  • tripleee, right, post edited Mar 13, 2012 at 5:46
5
-bash-4.1$ ls'
>

it means that you open a long string with ' and didn't close it so bash is waiting for string(argument) ended with '

Use ls without any ' at the end.

0

"PS" stands for (probably) "prompt string". PS1 is what the shell would display as your shell process's command line prompt. PS2 is displayed when further input is required to complete the command (unquoted string, reading from stdin, etc.). man bash then search for PS1 or PS2 (/PS[12]<CR>)

You must log in to answer this question.

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