Closed albestro closed 10 months ago
Symbol ~ (tilde) might not get expanded in some shells (POSIX, zsh, see this for reference)
~
Using HOME=$HOME makes it more generic and it should work with more shell interpreters.
HOME=$HOME
➜ ~ for shell in bash sh zsh; do echo -n "$shell => " ; $shell -c 'env -i - HOME=~ printenv HOME'; done bash => /users/ialberto sh => ~ zsh => ~ ➜ ~ for shell in bash sh zsh; do echo -n "$shell => " ; $shell -c 'env -i - HOME=$HOME printenv HOME'; done bash => /users/ialberto sh => /users/ialberto zsh => /users/ialberto
Since the workaround was about a problem with font-util (#143) I double-checked it still works.
font-util
# BASH ➜ bash -c "env -i - fc-cache -v 1>/dev/null" /usr/share/fonts: failed to write cache ➜ bash -c "env -i - HOME=$HOME fc-cache -v 1>/dev/null"
# ZSH ➜ zsh -c "env -i - fc-cache -v 1>/dev/null" /usr/share/fonts: failed to write cache ➜ zsh -c "env -i - HOME=$HOME fc-cache -v 1>/dev/null"
Moreover, in the cases where tilde is not expanded, as a side-effect a directory with name ~ is actually created.
➜ find . . ➜ bash -c "env -i - HOME=~ fc-cache -v 1>/dev/null" ➜ find . . ➜ zsh -c "env -i - HOME=~ fc-cache -v 1>/dev/null" ➜ find . . ./~ ./~/.cache ./~/.cache/fontconfig ./~/.cache/fontconfig/CACHEDIR.TAG ./~/.cache/fontconfig/3830d5c3ddfd5cd38a049b759396e72e-x86_64.cache-7
Symbol
~
(tilde) might not get expanded in some shells (POSIX, zsh, see this for reference)Using
HOME=$HOME
makes it more generic and it should work with more shell interpreters.font-util
Since the workaround was about a problem with
font-util
(#143) I double-checked it still works.Moreover, in the cases where tilde is not expanded, as a side-effect a directory with name
~
is actually created.