Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我尝试这样的事情时:
( echo && { echo ; echo } )
我越来越:
-bash: syntax error near unexpected token `)'
我确定我需要使用 subshell。而且我确定我需要在其中进行分组。那么如何避免语法错误呢?先感谢您!
命令列表必须以;换行符或换行符结束。
;
而是说:
( echo && { echo ; echo ; } ) ^^^ |======= Add this
来自info bash:
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. ...