英文:
'>' Terminal mode activated when I accidentally type an extra apostrophe
问题
这是什么模式,请有人给我解释一下?谢谢。
我在互联网上查找了一下,但是完全找不到这个模式是什么。
英文:
What is this mode please may someone enlighten me? Merci
I looked on the interwebs and couldn't find diddly squat at what mode it is.
答案1
得分: 0
除非它们被转义,否则引号('
)用于包围字符串,防止Shell解析它。当在开头引号之后有一个换行时,你告诉Shell你想输入一个多行字符串。>
是该字符串在另一行上的继续。
让我们看一个说明这一点的例子:
mureinik@computer /tmp
$ echo 'this is the first line
> and this is the second
> and now we will terminate the string on the third, with a closing quote -> '
this is the first line
and this is the second
and now we will terminate the string on the third, with a closing quote ->
英文:
Unless they're escaped, quotes ('
) are used to surround a string and prevent the shell from parsing it. When you have a linebreak after an opening quote, you're telling the shell that you want to input a multilined string. The >
is the continuation of the that string on another line.
Let's see an example that illustrates this:
mureinik@computer /tmp
$ echo 'this is the first line
> and this is the second
> and now we will terminate the string on the third, with a closing quote -> '
this is the first line
and this is the second
and now we will terminate the string on the third, with a closing quote ->
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论