現在、bash で次のコマンドを入力する際に問題が発生しています。
RESPONSE=`curl -k "$line" --cert=\"$certfile:$certpassfile\" --silent --write-out --head '%{http_code}\n'`
ここ$line
で、 は URL、$certfile
は pem ファイルへのパス、$certpassfile
は証明書のパスワードです。
次のエラーが表示されます。
++ curl -k url '--cert="/certpath:certpassword"' --silent --write-out --head '%{http_code}\n'
curl: オプション --cert="/certpath:certpassword": 不明
証明書ファイルを二重引用符で囲み、エスケープしない場合、コマンドは次のようになります。
RESPONSE=`curl -k "$line" --cert="$certfile:$certpassfile" --silent --write-out --head '%{http_code}\n'`
同じエラーが表示されますが、パスが異なります。
++ curl -k url --cert=/certpath:certpassword --silent --write-out --head '%{http_code}\n' curl: オプション --cert=/certpath:certpassword: 不明
コマンドを作成する方法は次のとおりです。
curl -k url --cert="/certpath:certpassword" --silent --write-out --head '%{http_code}\n'