i feel silly i didnt know this #bashism already. take a ; delimited list and loop on it's values
DATA="this=that;is=isnt;a=b;list=ok"
D=""
for opt in ${DATA//;/ }; do
D="${D} -d ${opt}"
done
curl -x POST "$D" api/search
@davetron5000 BTW, the code I posted before had errors. Here's a one-liner that actually works with #Docker and #AlpineLinux.
```bash
docker run --privileged -i --rm alpine:latest \
<<< 'apk update && apk add usbutils && lsusb -t && exit'
```
The redirection operator is a #bashism that won't work as-is in #Bourne or #FishShell. However, I validated that it works as intended under Bash, and thus probably under #Z-Shell. Hope it's useful to you, or to anyone running #TrueNAS Scale.
i feel silly i didnt know this #bashism already. take a ; delimited list and loop on it's values
DATA="this=that;is=isnt;a=b;list=ok"
D=""
for opt in ${DATA//;/ }; do
D="${D} -d ${opt}"
done
curl -x POST "$D" api/search
“source” is a #bashism. The actual #POSIX name of the command is “.”. That’s right, a single dot.
Many people expect . to be some kind of a shortcut for “source”, and yes, they’re equivalent in #bash, but “source” is not guaranteed to exist in other shells. dash doesn’t have it, for example.
So, if you want to write your shell scripts as compatible as possible, use “.”, not “source”.
@konst Since you’re saying “etc.”, I feel compelled to mention that `<<<` works in bash, but is not in POSIX and will therefore for example not work in #!/bin/sh scripts in Debian. See https://mywiki.wooledge.org/Bashism