繁体   English   中英

Bash:子外壳中带有花括号的命令分组

[英]Bash: command grouping with curly braces inside subshell

当我尝试这样的事情时:

( echo && { echo ; echo } )

我越来越:

-bash: syntax error near unexpected token `)'

我确定我需要使用subshel​​l。 而且我确定我需要在其中进行分组。 那么如何避免语法错误? 先感谢您!

命令列表必须以;终止; 或换行符。

而是说:

( echo && { echo ; echo ; } )
                       ^^^
                        |======= Add this

info 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. ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM