警报!:不支持的URL方案!使用lynx发送批量短信时出错

时间:2014-12-01 07:45:40

标签: linux bash

团队友好地帮助解决错误警报!:不支持的URL方案!在linux bash脚本中发送批量短信时。 lynx命令适用于静态URL。这就是我在下面的内容

#!/bin/bash
a="lynx -dump 'http://localhost:13013/cgi-bin/sendsms?from=8005&to="
b="&username=tester&password=foobar&smsc=smsc1&text=Test+mt+update'"
for i in cat numbers.txt;do $a$i$b;echo sent $i; done;

258909908780
256789123456
676675234789

1 个答案:

答案 0 :(得分:0)

问题是http:之前的单引号。扩展变量后不会处理引号,因此它会逐字地发送到lynx。没有'http URL方案,因此出现错误消息。

删除http:之前和+update之后的引号。

#!/bin/bash
a="lynx -dump http://localhost:13013/cgi-bin/sendsms?from=8005&to="
b="&username=tester&password=foobar&smsc=smsc1&text=Test+mt+update"
for i in $(cat numbers.txt);do $a$i$b;echo sent $i; done;

有关此内容的更多信息,请参阅

Setting an argument with bash

相关问题