【发布时间】:2013-11-16 10:49:52
【问题描述】:
我目前在 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: option --cert=/certpath:certpassword: 未知
知道如何创建命令应该是:
curl -k url --cert="/certpath:certpassword" --silent --write-out --head '%{http_code}\n'
【问题讨论】: