Potential problem with "&" and "?" characters in CURL url syntax
by mackowiakp from LinuxQuestions.org on (#5CJX3)
I am using a USB audio dongle to listen an internet radio stream. I use the script below for this (part of it). Pipe file and curl are used because mpg123 does not allow to stream https streams.
Code:#!/bin/bash
#
[ ! -e /dev/shm/pipe ] && /usr/bin/mkfifo /dev/shm/pipe
#
# two examples of URL:
# first URL
url="https://streamer.radio.co/s93b51ccc1/listen" # works OK
#
# second URL
url="https://n16.rcs.revma.com/ye5kghkgcm0uv?rj-ttl=5&rj-tok=AAABduCGJMEAy9tjW1s2OucgHA" # does not work
/usr/bin/curl -Ls $url -o /dev/shm/pipe & mpg123 -q --stdout /dev/shm/pipe 2>/dev/null | aplay -q -D sysdefault:Set --file-type raw --format=cd 2>/dev/null &In case of first URL, it works OK. In case of second URL, an error is reported.
Code:bash: rj-tok=AAABduCGJMEAy9tjW1s2OucgHA: command not foundThe same problem is when question mark is used in URL.
Anybody know what should be a proper syntax?


Code:#!/bin/bash
#
[ ! -e /dev/shm/pipe ] && /usr/bin/mkfifo /dev/shm/pipe
#
# two examples of URL:
# first URL
url="https://streamer.radio.co/s93b51ccc1/listen" # works OK
#
# second URL
url="https://n16.rcs.revma.com/ye5kghkgcm0uv?rj-ttl=5&rj-tok=AAABduCGJMEAy9tjW1s2OucgHA" # does not work
/usr/bin/curl -Ls $url -o /dev/shm/pipe & mpg123 -q --stdout /dev/shm/pipe 2>/dev/null | aplay -q -D sysdefault:Set --file-type raw --format=cd 2>/dev/null &In case of first URL, it works OK. In case of second URL, an error is reported.
Code:bash: rj-tok=AAABduCGJMEAy9tjW1s2OucgHA: command not foundThe same problem is when question mark is used in URL.
Anybody know what should be a proper syntax?