w='@ @' check() { [ "$v" = "$w" ] || echo "Expected $w got $v" } export v=$w check HOME=/known/value check() { [ "$v" = ~ ] || echo "Expected $HOME got $v" } export v=~ check check() { [ "$v" = "x:$HOME" ] || echo "Expected x:$HOME got $v" } export v=x:~ check