Bash 错误 [: 检查文件是否存在时缺少 `]'
Bash error [: missing `]' when checking if file exists
当 运行 bash 中的下一行时,我收到错误 [: missing
]'`。
if [ ! -f "$file"]; then
echo "File not found!"
fi
改变
[ ! -f "$file"]
至
[ ! -f "$file" ]
更改摘要:在 ]
之前添加了 space
当 运行 bash 中的下一行时,我收到错误 [: missing
]'`。
if [ ! -f "$file"]; then
echo "File not found!"
fi
改变
[ ! -f "$file"]
至
[ ! -f "$file" ]
更改摘要:在 ]