3 ms·
Bash is a Lisp, too. https://blog.danieljanus.pl/2014/05/20/you-already-use-lisp-syntax/ https://blog.danieljanus.pl/2014/05/20/you-already-use-lisp-...
by nathell 2y ago
Bash is a Lisp, too.
https://blog.danieljanus.pl/2014/05/20/you-already-use-lisp-syntax/ https://blog.danieljanus.pl/2014/05/20/you-already-use-lisp-...
- ptx 2y agoBash feels more like a C buffer overflow vulnerability than a Lisp: When you're not careful your data tends to leak across its boundaries and get mixed up with your code. Is there a way to quote data in Bash to safely insert it into a piece of code, the way you can in Lisp?
- kazinator 2y agoIn Bash, yes. Or, almost. 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.