我想判断这两个文件是否都存在,但我正在
test.sh: line 3: [: missing `]'
有人知道怎么了吗?
#!/bin/sh
if [ -f .ssh/id_rsa && -f .ssh/id_rsa.pub ]; then
echo "both exist"
else
echo "one or more is missing"
fi
我想判断这两个文件是否都存在,但我正在
test.sh: line 3: [: missing `]'
有人知道怎么了吗?
#!/bin/sh
if [ -f .ssh/id_rsa && -f .ssh/id_rsa.pub ]; then
echo "both exist"
else
echo "one or more is missing"
fi
try 添加一个额外的方括号.
if [[ -f .ssh/id_rsa && -f .ssh/id_rsa.pub ]]; then