Shell quoting for bash wrappers

Bash 4.4 reduces quoting/escaping hell

TIL ${*@Q} helps with quoting/escaping hell.

If you ever like to write bash wrapper scripts that then pass on the command-line arguments as additional arguments to the wrapped command, this will quote them so you don’t have to deal with double-quoting or escaping. It literally means: “take each positional parameter, shell-quote it, and join with spaces”

So your script can do:

ssh dbserver "mysql ${*@Q} dbname"

Which, if the wrapper is run with arguments: -e "select 1", will act like the command was:

ssh dbserver "mysql '-e' 'select 1' dbname"