intrigeri:
>>> Buggy handling of wrapped commands whose arguments contain
>>> spaces
> [...]
>> Confirmed. I don't know how to fix it. Ideas?
>
> The answer might emerge from that question of mine:
>
>>> (is going through getopt necessary for the wrapped command at
>>> all?):
>
> If the answer is "yes", then I suggest having a look at the
> various options offered by getopt for whitespace / command-line
> words parsing.
The answer is: I don't know. I don't know the alternatives.
Afaik getopt does not support multiple arguments, i.e. -i ip -p port.
Only -i ip -o. (-o just as an option flag without additional argument.)
That's why getopts is being used. On the other hand, getopts does not
have options for whitespace...
I haven't found any similar bash scripts. Search results are more
questions than answers. Not sure if it's possible with bash at all.
It's really difficult for me.
And what's strange... When a wrapper is being used, for example a gpg
wrapper [1], the relevant part:
/usr/local/bin/uwt -t 5 -i "$ip" -p "$port" -c "/usr/bin/gpg $*"
It works.
If you could help with it, that'd be great.
[1]
https://github.com/adrelanos/aos/blob/a07832e2dcee34cc48f896fae5a7f7c2bc64e298/aos_shared/usr/local/bin/gpg