feat: support escaping $ in variable expansion (#491)
"$" can now be escaped by adding a second "$$". For example, "$$FOO"
will expand to "$FOO".
Go's os.Expand does not natively support escaping $, so we must do it
ourselves. This can normally be done by adding a case for "$" and
returning back "$", effectively collapsing "$$" into "$". However,
because Hermit calls os.Expand repeatedly until no more expansion
occurs, and because Hermit expands environment variables from packages
twice, we need a slightly more complex solution.
By having the environment mapping turn "$" into "$$", these escaped
dollar signs can remain the same. For non-envar expansion, we can simply
call strings.ReplaceAll(str, "$$", "$"). For envars, we employ the naive
method mentioned earlier on the *second* round of expansions.
Fixes #486
---------
Co-authored-by: Sutina Wipawiwat <wsutina@gmail.com>