What does this do in bash: [@]?

Jon LaBadie ubu at labadie.us
Sun Jul 31 05:22:14 UTC 2022


On Sun, Jul 31, 2022 at 07:00:24AM +0200, Bo Berglund wrote:
>On Sat, 30 Jul 2022 12:40:19 -0400, Jon LaBadie <ubu at labadie.us> wrote:
>
>>On Sat, Jul 30, 2022 at 02:22:06PM +0200, Bo Berglund wrote:
>>...
>>>
>>>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...
>>>
>>Perhaps:
>>
>>   eval echo "$CMD"
>>
>>or
>>
>>   eval printf "%s\n" "$CMD"
>>
>
>Why?
>

My assumption, perhaps faulty, was the URL would be contained in $CMD 
but that you could not visualize it nor extract it for processing.

My suggestion may output the fully "eval"uated $CMD to stdout.
You could then examine it on a terminal or perhaps capture it
in a variable, ex. var=$(eval echo "$CMD")

>Execution of the command for download works just fine with eval "$CMD" ....
>
>I added the printf to file just to be able to inspect the URL extracted by the
>strange looking command shown and it turns out to be a very long line NOT ending
>with .m3u8 and can thus not be used in my KODI media player in a strm file for
>live viewing.
>
>The problem is not how to execute commands but rather how to script getting a
>working m3u8 URL like I can interactively do using Firefox F12 debug screen.
>
>And my question here was about the use of "${URL[@]}" in:
>
>INPUT=$("$CURL" -qsS "${URL[@]}"  | jq -Mr '.akamai[] | .tokenizedUrl'
>
>That command was given to me on a video forum and works for the download purpose
>but not for the media player.
>
>

-- 
Jon H. LaBadie                  ubu at labadie.us




More information about the ubuntu-users mailing list