I want to run command:
curl -H "X-Auth-Token: $OS_TOKEN" "http://192.168.0.13:8774/v2.1/servers"
And, I made the script for it.
URL="http://192.168.0.13:8774/v2.1/servers"
HEADER="X-Auth-Token: 12345678"
METHOD="GET"
CMD="curl -H $HEADER $URL"
eval "$CMD"
But, as it doesn't include any double quotes in $CMD
and separates parameters by space, it runs wrong command
$ bash request.sh
curl: (6) Could not resolve host: 12345678
How can I wrap it? In command line, we can give double quotes to separate parameters.
But how can I put a variable with spaces to a parameter using scripts as same as command line.