[ -r "$df" ] && {
tail -1 $df | grep "$was_fallback" > /dev/null
[ $? -ne 0 ] && { continue; }
这是更大代码的一部分。我正在阅读一些前辈写的旧代码。然后我找到了这段代码。我知道 [ ] 适用于“如果”条件。但是这个 {} 是做什么用的?
I know that [ ] is for 'if' condition
不,这不是if条件。[
是测试命令。更多关于它的信息:
what is this {} used for?
这称为命令分组。来自 GNU 手册:
{}
{ list; }
Placing a list of commands between curly braces causes the list to be
executed in the current shell context. No subshell is created.
The semicolon (or newline) following list is required.