Bash is a Lisp, too.
https://blog.danieljanus.pl/2014/05/20/you-already-use-lisp-...
https://blog.danieljanus.pl/2014/05/20/you-already-use-lisp-...
Is there a way to quote data in Bash to safely insert it into a piece of code, the way you can in Lisp?
The printf built-in command has a %q conversion specifier which quotes the argument such that the result can be used as input into the shell.
Such a thing cannot be inserted into a quote without affecting its meaning, but what you can do is terminate the quote before and after it.
'stuff before'$(printf "%q" "$value")'stuff after'
In this case, because it's a single quote, we need to terminate it anyway, order to activate the command substitution syntax.