Yeah, another way to do it is
#!/bin/bash
set -euo pipefail
if [[ $# -lt 1 ]]
then
echo "Usage: $0 argument1" >&2
exit 1
fi
i.e. just count arguments. Related, fish
has kind of the orthogonal situation here, where you can name arguments in a better way, but there’s no set -u
function foo --argument-names bar
...
end
in the end my conclusion is that argument handling in shells is generally bad. Add in historic workarounds like if [ "x" = "x$1" ]
and it’s clear shells have always been Shortcut City
Side note: One point I have to award to Perl for using eq/lt/gt/etc
for string comparisons and ==/</>
for numeric comparisons. In shells it’s reversed for some reason? The absolute state of things when I can point to Perl as an example of something that did it better
Privacy focused services will generally be sought after by nazis, illegal arms dealers, CSAM dealers (but I repeat myself). But like with the nazi bar analogy, they need to handle it properly and take certain stances to avoid that group becoming their only customers—and the rest of us blocking it.