0

When I run the following, it works and returns one item.

online

curl -X POST -d 'tag=jazz' -d 'state=queensland' http://all.api.radio-browser.info/json/stations/search 

But in a Bash script, when I use -d 'tag=jazz' -d 'state=queensland' for RES, I get different outputs.

read -rp "Write your quiry " RES echo "$RES" curl -X POST "$RES" http://all.api.radio-browser.info/json/stations/search 

I tried this but it didn't work.

curl -X POST http://all.api.radio-browser.info/json/stations/search <<EOF "$RES" EOF 

How can I use a variable in a Bash script?

3

1 Answer 1

1

Use an array as in the answer to your previous question:

read -rp 'Write your query ' -a RES curl -X POST "${RES[@]}" http://all.api.radio-browser.info/json/stations/search 

Enter your arguments without single quotes since they are saved literally into the array, i.e. use

-d tag=jazz -d state=queensland 
0

    You must log in to answer this question.

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.