2

当我尝试这样的事情时:

( echo && { echo ; echo } )

我越来越:

-bash: syntax error near unexpected token `)'

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

4

1 回答 1

5

命令列表必须以;换行符或换行符结束。

而是说:

( 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. ...
于 2014-05-19T18:41:37.197 回答