What does this do in bash: [@]?
Little Girl
littlergirl at gmail.com
Sun Jul 31 13:51:40 UTC 2022
Hey there,
Bo Berglund wrote:
>URL=('https://tokens.xxxxx.com/' -d $'{\n "pid": "2007524",\n
>"application": "Sports",\n "platform": "desktop",\n "cdn":
>"akamai",\n "url":
>"https://xxxxxxx.akamaized.net/hls/live/723429/Sportsa418c506/clear/master.m3u8"\n}')
>I want to understand what is going on in here so I can modify it to
>get what I want...
That URL is space-separated and contains these items:
Its first item is:
https://tokens.xxxxx.com/
Its second item is:
-d
Its third item is:
{
"pid": "2007524",
"application":"Sports",
"platform": "desktop",
"cdn": "akamai",
"url":"https://xxxxxxx.akamaized.net/hls/live/723429/Sportsa418c506/clear/master.m3u8"
}
====================
# If I just echo the URL:
echo "$URL"
# I get this output:
https://tokens.xxxxx.com/
====================
# If I use [@] to expand the URL:
echo "${URL[@]}"
# I get this output:
https://tokens.xxxxx.com/ -d {
"pid": "2007524",
"application":"Sports",
"platform": "desktop",
"cdn": "akamai",
"url":"https://xxxxxxx.akamaized.net/hls/live/723429/Sportsa418c506/clear/master.m3u8"
}
====================
# If I loop through the URL using FOO to mark the beginning of each
item:
for i in "${URL[@]}"; do
echo "FOO$i"
done
# I get this output:
FOOhttps://tokens.xxxxx.com/
FOO-d
FOO{
"pid": "2007524",
"application":"Sports",
"platform": "desktop",
"cdn": "akamai",
"url":"https://xxxxxxx.akamaized.net/hls/live/723429/Sportsa418c506/clear/master.m3u8"
}
====================
--
Little Girl
There is no spoon.
More information about the ubuntu-users
mailing list