Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

expanding variable in CURL [duplicate]

Tags:

shell

curl

The following curl statement works OK in my shell script.

curl -Ld'username=user&password=password&source=oksoft&dmobile='$mnumber'&message=Slave is working OK' http://167.123.129.195/smsclient//api.php

The Mobile number is expanded as expected. But when I use a variable for the message parameter, I get $myvar output instead of the expanded variable.

curl -Ld'username=user&password=password&source=oksoft&dmobile='$mnumber'&message="$myvar"' http://167.123.129.195/smsclient//api.php

How do I use the variable for the message?

like image 414
shantanuo Avatar asked Oct 23 '25 03:10

shantanuo


1 Answers

Single quotes inhibit expansion. Switch up the quotes.

curl ...'..."'"$myvar"'"...'...
like image 168
Ignacio Vazquez-Abrams Avatar answered Oct 25 '25 21:10

Ignacio Vazquez-Abrams