shithub: git9

Download patch

ref: 24677b0d857051fc2a952c1dbceaeefa540d89d6
parent: 57d8a0bd95309bcc221850b263acdccc4e81b6ea
author: kvik <kvik@a-b.xyz>
date: Wed Apr 8 12:53:13 EDT 2020

Introduce text substitution helper subst(1)
Using naive string concatenation to build sed substitution
commands causes problems when the variable text being
pasted contains embedded separator characters. Consider:

	; prefix='/path/user@host'
	; sed 's@^'$prefix'@@':
	sed: @: command garbled: s@^/path/user@host@@:

To fix and avoid such problems we introduce subst(1), a helper
utility working reliably with any regular expression and
substitute text arguments, as well as providing some
convenience.  The above sed command becomes:

	; subst '^'$prefix