‘>’ 当我意外输入多余的撇号时,终端模式被激活

huangapple go评论38阅读模式
英文:

'>' 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 ->

huangapple
  • 本文由 发表于 2023年2月8日 16:18:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75382945.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定