私は両方のファイルが存在するかどうかを確認したいのですが、誰もが間違っているものを見ることができます私は2つのファイルが存在するかどうかテストする方法は?
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'を使用すると、問題がより明確になります。 "if test -f .ssh/id_rsa && test -f .ssh/ir_rsa.pub; then"うまく動作します。 –