A nightmare in nesting for DLAGENTS
Ey, A package recently started making their download links be dynamically-generated and expire. I've found that the download link can be gotten through `curl 'https://www.larksuite.com/api/package_info?platform=10' | grep -oP '(?<="download_link":")[^"]*' --`. I've decided to implement this into the package through setting source to the API link and specifying DLAGENTS. However, I'm having trouble wrangling the quotes. Currently, I have DLAGENTS=('https::/bin/sh -c '\''curl -LO $(curl -s %u | grep -oP "(?<=\"download_link\":\")[^"]*")'\'''). The shell complains -LO: -c: line 1: unexpected EOF while looking for matching `''. (I'm not using jq because 1. it's an extra makedepends 2. I tried replacing the grep part with `jq -r .download_link` and it changes nothing.) I've been working at different ways of expressing this for a while now and all I've managed to change is which kind of quotation mark the shell complains about. Any ideas? -- Cheers, Aᴀʀᴏɴ
On 2025-07-07 20:25, S. Shuck wrote:
Can you use printf "%q" "$something_with_weird_character"? That format specifier will shell-escape whatever you use. See man printf
Thanks, using its output (literally, not enclosing it in $()) worked! PS: I noticed that in my original email I had accidentally omitted the `' --` from my DLAGENTS string. Rest assured (hah) that version still fails regardless. A mystery why, but it works with the %q approach! -- Cheers, Aᴀʀᴏɴ
participants (1)
-
Aaron Liu