Hello,

I have been playing around with tilde expansion lately and I think i
have discovered a case where the tilde is expanded where it, according
to the documentation, should not.

When running:

$ x=~

x is set to the current users home directory as expected.

$ echo $x

/home/christian

But when executing

$ echo x=~

x=/home/christian

is returned. This case looks like a variable assignment where the
expansion is expected but it is not, for that reason there should not be
an expansion since the tilde is not at the beginning of the word nor a
variable assignment is taking place.

sh and zsh both return the expected x=~

sh -c "echo x=~"

x=~

zsh -c "echo x=~"

x=~

bash -c "echo x=~"

x=/home/christian


I my understanding of the manual incorrect or is there some hidden
interaction with echo?

Greetings,

Christian Steinhaus



Reply via email to