cd ../notes

TIL ·

Print a value in reusable shell quoting

Bash 4.4 added the @Q parameter transformation, which quotes a value so it can be pasted back into a shell unchanged:

bash
var="it's here"
echo "${var@Q}"   # 'it'\''s here'

Handy in logs: echo "running: ${cmd[*]@Q}" shows exactly which arguments a command received.