0

Team kindly help on the error Alert!: Unsupported URL scheme! when snding bulk sms in linux bash script. the lynx command works fine for static URL. This is what i have got below

#!/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;

numbers

258909908780
256789123456
676675234789
uganda001
  • 5
  • 4

1 Answers1

0

The problem is the single quote before http:. Quotes are not processed after expanding variables, so it's being sent literally to lynx. There's no 'http URL scheme, hence the error message.

Remove the quotes before http: and after +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;

For more information about this, see

Setting an argument with bash

Community
  • 1
  • 1
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • What's the problem with `+`? – Barmar Dec 01 '14 at 08:01
  • But not in the script? – Barmar Dec 01 '14 at 08:04
  • And/or don't put the command in a variable. See also http://mywiki.wooledge.org/BashFAQ/050 – tripleee Dec 01 '14 at 08:08
  • The command lynx -dump 'http://localhost:13013/cgi-bin/sendsms?from=8005&to=256772575818&username=tester&password=foobar&smsc=smsc1&text=Sunday+Yes+But+Even+anytime.' works fine with response 0: Accepted for delivery and msg is sent, but when i modify the script with susgestions u advised i get error Number(s) has/have been denied by white- and/or black-lists. now this is strange. But one number works fine, the + is to put spaces in the message – uganda001 Dec 01 '14 at 08:09
  • You need to put quotes when you write the command normally. You _don't_ need the quotes when the command is coming from a variable. – Barmar Dec 01 '14 at 08:09