What does this do in bash: [@]?
Bo Berglund
bo.berglund at gmail.com
Sat Jul 30 12:22:06 UTC 2022
On Fri, 29 Jul 2022 20:02:15 +0100, Peter Flynn <peter at silmaril.ie> wrote:
>On 29/07/2022 17:40, Bo Berglund wrote:
>[...]
>> So do I get it right?:
>>
>> - Something gets stuffed into a bash variable like URL in the example
>
>So, for example URL="https://foo.bar.com/somepage?id=xyz&lastpage=35"
>
>> - When this variable is later used as the argument to curl then using [@] as
>> shown
>
>Do you mean $ curl "${URL[@]}"
>
>> makes the arguments in $URL load separately into curl as a list of
>> different arguments
I am looking at a download script where this construct exists:
CURL=$(command -v curl) #Get full path to the curl command
FFMPEG=$(command -v ffmpeg) #Get full path to the ffmpeg command
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}')
INPUT=$("$CURL" -qsS "${URL[@]}" | jq -Mr '.akamai[] | .tokenizedUrl')
I want to understand what is going on in here so I can modify it to get what I
want...
The INPUT variable is later used in an ffmpeg call as "${INPUT[@]}" like this:
CMD="ffmpeg -hide_banner -i \"${INPUT[@]}\" -vf scale=w=-4:h=480 -c:v libx264
-preset fast -crf 26 -c:a aac -t ${CAPTURETIME} ${TARGETFILE}"
eval "$CMD"
And this works with ffmpeg but I want to find a way to extract the m3u8 URL
itself so it can be used in strm files in KODI running on my Ubuntu machine for
direct live viewing too.
I have added a printf statement in the script to send $INPUT to a file before it
uses it so I can look at it afterwards and it does not looking like any URL I
recognize or can use. But ffmpeg seems to be fine with it...
--
Bo Berglund
Developer in Sweden
More information about the ubuntu-users
mailing list