[Top][All Lists]

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

Re: Should ~$user be tilde expanded?

From: Roman Rakus
Subject: Re: Should ~$user be tilde expanded?
Date: Thu, 25 Oct 2012 16:18:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 10/25/2012 04:07 PM, Clark WANG wrote:
See following example:

$ cat foo.sh
echo ~$u
$ bash foo.sh  # bash 4.2.37
$ ksh foo.sh  # ksh 93u+ 2012-08-01

Anyone can explain/confirm what should be the correct behavior?


The order of expansions is: brace expansion, tilde expansion, parameter, variable, and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and filename expansion.

And posix is saying:
The order of word expansion shall be as follows:

1. Tilde expansion (see Section 2.6.1), parameter expansion (see Section 2.6.2, on page 2306), command substitution (see Section 2.6.3, on page 2309), and arithmetic expansion (see
 Section 2.6.4, on page 2299).

So I will say, bash is doing it right. Firstly tries tilde expansion and then parameter expansion.


reply via email to

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