[tex-live] shell expansion of tilde

David Kastrup dak at gnu.org
Thu Jan 24 01:44:05 CET 2008


"Nelson H. F. Beebe" <beebe at math.utah.edu> writes:

> Werner LEMBERG <wl at gnu.org> asks about the behavior of shell expansion
> exhibited by this test, and wants to know if this is a bug in bash:
>
> 	$ export MT_TFMDESTDIR='~/bin'

Why export?

> 	$ eval FOO=\"$MT_TFMDESTDIR\"

This first constructs the string 'FOO="~/bin"' and then executes it.
Which assigns a quoted ~/bin to FOO.

> 	$ echo $FOO
> 	~/bin

Tilde expansion is done before parameter expansion.

> 	$ eval FOO="$MT_TFMDESTDIR"

This constructs the string 'FOO=~/bin' and then executes it.  Since ~ is
not quoted in the execution, tilde expansion happens.

> 	$ echo $FOO
> 	/u/sy/beebe/bin
>
> 	$ eval FOO=$MT_TFMDESTDIR

Actually the same.

> 	$ echo $FOO
> 	/u/sy/beebe/bin
>
> I've made this experiment with bash (3.2.33(1)), ksh (Version M
> 1993-12-28 o+), pdksh (PD KSH v5.2.14 99/07/13.2), and zsh (4.1.1),
> and get identical behavior.

What else would you expect?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


More information about the tex-live mailing list