I've googled and tried so many things and never could get anything to work with ${parameter@operator}. All I find is more links to the same documentation. So I think a proper answer with practical examples would be very helpful to its understanding.
The documentation says:
${parameter@operator}
The expansion is either a transformation of the value of parameter or information about parameter itself, depending on the value of operator. Each operator is a single letter:
Q
The expansion is a string that is the value of parameter quoted in a format that can be reused as input.
It also says about quoting:
3.1.2 Quoting
Quoting is used to remove the special meaning of certain characters or words to the shell.
So my reasoning is that the output of this (special character $):
a="To be reused as an input string, \$0 needs to be quoted"
echo ${a@Q}
should be this (between "", the '\' is removed, so needs quoting again to be used as an input):
To be reused as an input string, \$0 needs to be quoted
but I get:
bash: ${a@Q}: bad substitution
I tried different combinations of:
${a@q}, "${a@Q}", a='To be reused as an input string, $0 needs to be quoted'
to no avail.
Actually, any operators I try to use always yields the bad substitution error. Those seems to be very obscure features of bash. I've omitted from this post about half an hour of attempts each one more twisted than the previous!