NOTE: such behavior as shown in your example is specific to Bourne-like shells, including bash, dash (on Ubuntu it is symlinked to /bin/sh), ksh, and mksh. Although it is indeed possible to have filenames that contain special characters in them, it is always avoided. Such an executable filename cannot be found (and typically command filenames should consist of only alphanumeric characters, plus underscores, dashes, and dots). Thus, as Zanna pointed out, you are entering a command that consists of newline+ ls+newline. In your particular case, a single quote implies literal interpretation of what is between the single quotes. When pipes, logic operators, or special keywords appear on command-line before newline, the command also is considered incomplete until all final statements are entered: $ echo Hello World | Very often continuation of a lengthy command can be done by adding \ and immediate(!) newline, which will cause the same prompt to appear: $ echo Hello\ I need your clothes, your boots, and your motorcycle. The same prompt is used when you perform here-doc redirection (where a command is considered complete when you see the terminating string, in this example, EOF): $ cat line one 18 Best Terminator Quotes: We Know Youll Be Back For More 1. There are many ways in which shell may show the PS2 prompt (and where completing a command on a new line might be necessary). In politics, as in love, opposites attract. Secondary or terminal infections are the real cause of death. Patients rarely die of the disease from which they suffer. In this case we're more interested in PS2. The worst that could happen wasnt crashing and burning, it was accepting terminal boredom as a tolerable status quo. There's others, too: PS3 for select command block and PS4 for debugging with set -x command. The PS1 prompt is your string, which shows up normally when you enter commands. Thus, as you may guess from reading the documentation, shells have multiple prompts with different purposes. Primary prompt PS1 when it is ready to read aĬommand, and the secondary prompt PS2 when itĪnd a little before that: PS2 The value of this parameter is expanded When executing interactively, bash displays the Effectively, the shell asks for a complete command/expression, and for that reason is displaying the PS2 prompt string.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |