Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I tried search on internet, found nothing.

share|improve this question

migrated from stackoverflow.com Mar 13 '12 at 5:56

This question came from our site for professional and enthusiast programmers.

add comment

3 Answers

up vote 33 down vote accepted

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.

share|improve this answer
2  
You have good eyes to spot the stray single quote. –  mu is too short Mar 13 '12 at 5:39
1  
Added info: To get out, just enter another single quote, or press ctrl-c. –  octern Mar 13 '12 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 '12 at 5:43
1  
Better use ctrl-d instead of ctrl-c as EOF (End Of File) –  sputnick Mar 13 '12 at 5:44
    
thanks, BTW what does PS2 stand for? –  Anders Lind Mar 13 '12 at 5:45
show 4 more comments
-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.

share|improve this answer
add comment

Anders Lind: "PS2" stands for "Playstation 2".

Just kidding. :)

"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>)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.