linux - 警报!使用 lynx 发送批量短信时出现 : Unsupported URL scheme! 错误

标签 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

最佳答案

问题出在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

关于linux - 警报!使用 lynx 发送批量短信时出现 : Unsupported URL scheme! 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27223806/

相关文章:

Python shebang 和换行符

bash - 无法添加 Vagrant scotchbox

bash 将前导零添加到计数中

linux - "mv file1 *.file1"是做什么的?

Linux 使用交换而不是 RAM 进行大图像处理

linux - 在 Linux 上运行程序化 Postgres 数据库迁移的最佳实践

linux - Bash oneliner 重命名文件名

java - 如何在 Java 中以 root 身份执行 shell 命令

ruby - 如何锁定 ruby 中fork共享的IO

c++ - Linux、Eclipse、ARM 工具链和 Codan 错误