I've got a file that holds a token:
$ cat .token
token="35aaac83-cd67-5ced-a3b5-00c388f725c5"
I am trying to use this file inside a Bash function:
func() {
. .token
local payload='{
"jsonrpc": "2.0",
"method": "listFile",
"params": [ "'"$token"'", "/" ],
"id": 1
}'
echo "$payload"
}
When I run this function, the output is:
{
"jsonrpc": "2.0",
"method": "listFile",
", "/" ],params": [ "35aaac83-cd67-5ced-a3b5-00c388f725c5
"id": 1
}
As you can see, the line with params
gets wrapped onto itself. I can't figure out why. I've been able to ascertain this has something to do with the .
sourcing of the $token
: when I hardwire $token
, everything works fine. What's that matter here?