Linux 带花括号的sudo-H

Linux 带花括号的sudo-H,linux,bash,shell,Linux,Bash,Shell,我在lodash.com上看到了以下安装片段: $ {sudo -H} npm i -g npm 为什么会有花括号 以下两者的区别在哪里: $ sudo -H npm i -g npm 谢谢 更新:查看您的问题评论。它与bash无关 bash手册页的摘录。希望这有帮助 {list;} list is simply executed in the current shell environment. list must be terminated w

我在lodash.com上看到了以下安装片段:

$ {sudo -H} npm i -g npm
为什么会有花括号

以下两者的区别在哪里:

$ sudo -H npm i -g npm

谢谢

更新:查看您的问题评论。它与bash无关

bash手册页的摘录。希望这有帮助

{list;}

         list is simply executed in the current shell environment.   list
         must  be  terminated with a newline or semicolon.  This is known
         as a group command.  The return status is  the  exit  status  of
         list.   Note that unlike the metacharacters ( and ), { and } are
         reserved words and must occur where a reserved word is permitted
         to  be  recognized.   Since they do not cause a word break, they
         must be separated from  list  by  whitespace  or  another  shell
         metacharacter.

您的第一个示例不起作用,原因正如Emil Kakkau的手册页摘录所解释的。大括号周围必须有空格,命令列表必须以分号结尾。这是lodash安装的示例。资料来源:arrrgh。这与bash无关。在这种情况下,如果您还不是root用户,那么它只意味着将
npm
sudo-H
一起使用。此前缀在此处是可选的。用法取决于安装node.js软件包的位置。如果它们放在用户目录中,那么您可能不需要
sudo-H
前缀。希望这会有帮助。好吧,但是:{sudo-H}npm i-g npm和sudo-H npm i-g npm之间有区别吗?不是真的!我已经看过手册了。但是{sudo-H}只是一个带选项的命令,所以为什么我需要用花括号写这个呢?请检查括号扩展。也许它只是扩展到sudo-H,实际上它是一个选项。此命令是否使用括号?尝试使用其他命令,但在使用这些括号时,这些命令都不起作用。关于括号扩展,类似于
ls/bin/{date}
的命令将起作用。但是如果没有上下文,很难说
{sudo-H}
是如何解释的。