':不是有效的标识符Read和Curl

时间:2017-06-06 18:51:21

标签: linux bash shell curl

#!/bin/bash
# Connection to CR 
read -p "CRIP: " varCRIP
read -p "CRUSER: " varCRUSER
read -p "CRPASS: " varCRPASS
echo curl -k -X GET “http\://$varCRIP/cgi-bin/CGILink\?cmd=validate\&user=$varCRUSER\&passwd=$varCRPASS”
#curl -k -X GET “http\://$varCRIP/cgi-bin/CGILink\?cmd=validate\&user=$varCRUSER\&passwd=$varCRPASS"
btude@DESKTOP-SQI0GTI:~$ ./ccr.sh
': not a valid identifiervarCRIP
': not a valid identifiervarCRUSER
': not a valid identifiervarCRPASS
curl -k -X GET “http:///cgi-bin/CGILink?cmd=validate&user=&passwd=”

HELP!

我正在尝试在var中输入数据,然后将其插入curl命令中以运行

1 个答案:

答案 0 :(得分:1)

您的报价看起来很奇怪。这可能意味着你的东西中有一个不易破碎的空间,因为你从MS-Word或其他东西复制/粘贴。

尝试此操作(手动重新输入空格):

read -p "CRIP:" varCRIP
read -p "CRUSER:" varCRUSER
read -p "CRPASS:" varCRPASS

然后更改你的报价:

curl -k -X GET 'http\://$varCRIP/cgi-bin/CGILink\?cmd=validate\&user=$varCRUSER\&passwd=$varCRPASS'