Re: Unexpected tilde expansion
On 6/1/16 9:33 AM, Christian wrote: > 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 in its default mode, bash expands the tilde in that situation because it always has. When running in Posix mode, it doesn't. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/
Re: Unexpected tilde expansion
On Wed, Jun 01, 2016 at 04:57:46PM +0200, Ángel González wrote: > On 2016-06-01 at 10:40 -0400, Greg Wooledge wrote: > > On Wed, Jun 01, 2016 at 03:33:23PM +0200, Christian wrote: > > > sh and zsh both return the expected x=~ > > > > > > sh -c "echo x=~" > > > > > > x=~ > > > > imadev:~$ bash -c 'echo x=~' > > x=/net/home/wooledg > > imadev:~$ bash -posix -c 'echo x=~' > > x=~ > > Even if it's a bash extension, it should be documented. Christian is > right in that it's an unexpected behavior. It's documented (in reverse, by saying that POSIX mode *doesn't* do it) at http://tiswww.case.edu/~chet/bash/POSIX which in turn is referenced in the SEE ALSO section of the man page.
Re: Unexpected tilde expansion
On 2016-06-01 at 10:40 -0400, Greg Wooledge wrote: > On Wed, Jun 01, 2016 at 03:33:23PM +0200, Christian wrote: > > sh and zsh both return the expected x=~ > > > > sh -c "echo x=~" > > > > x=~ > > imadev:~$ bash -c 'echo x=~' > x=/net/home/wooledg > imadev:~$ bash -posix -c 'echo x=~' > x=~ Even if it's a bash extension, it should be documented. Christian is right in that it's an unexpected behavior.
Re: Unexpected tilde expansion
On Wed, Jun 01, 2016 at 03:33:23PM +0200, Christian wrote: > sh and zsh both return the expected x=~ > > sh -c "echo x=~" > > x=~ imadev:~$ bash -c 'echo x=~' x=/net/home/wooledg imadev:~$ bash -posix -c 'echo x=~' x=~
Unexpected tilde expansion
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