我正在尝试检查文件是否存在:这按预期工作:
if [ -e "/tmp/test.*.lock" ]; then
echo "exists!"
fi
Run Code Online (Sandbox Code Playgroud)
这不会:
if [[ -e /tmp/test.*.lock ]]; then
echo "exists!"
fi
Run Code Online (Sandbox Code Playgroud)
文件名可能类似于 /tmp/test.123.lock
我找不到让它与“[[”版本一起工作的方法。有人可以解释一下为什么以及如何让它发挥作用吗?