[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unexpected tilde expansion

From: Christian
Subject: Unexpected tilde expansion
Date: Wed, 1 Jun 2016 15:33:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0


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


But when executing

$ echo x=~


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=~"


zsh -c "echo x=~"


bash -c "echo x=~"


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


Christian Steinhaus

reply via email to

[Prev in Thread] Current Thread [Next in Thread]