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.
我试图理解这段代码:
. functions.sh || { : ; echo "Error while loading the specified file" >&2; exit 2; }
我知道当指定的文件不可用时,括号中的代码被调用。但这: ;意味着什么?此外,当您删除它时,该脚本将不起作用。
: ;
冒号是空语句,所以它什么也不做。分号结束命令列表。
不知道为什么有人会写上面的内容,基本上是“什么都不做,然后做echo”,这似乎可以简化。可能是某人的复制粘贴包袱。
echo