On Fri, Dec 16, 2011 at 09:47:54AM +0100, LEVAI Daniel wrote:

> Hi!
> 
> 
> I can't get my around this:
> 
> $ pwd
> /home/daniell
> 
> $ cd ~"/stuff/"
> ksh: cd: /home/daniell/~/stuff - No such file or directory
> 
> $ cd ~/"stuff/"
> $ pwd
> /home/daniell/stuff
> 
> 
> It seems  ~  is substituted in the first case, but it is not replaced,
> and it remained in the list.
> 
> What is even more weird:
> $ echo ~"/stuff"
> ~/stuff
> 
> ^^^ here it is not even substituted.
> 
> $ echo ~/"stuff"
> /home/daniell/stuff
> 
> ^^^ whereas here it is.
> 
> 
> I suspect this is not a feature?

Tilde expansion is tricky stuff. If you read how it is defined (man
ksh), it says:

====
The characters following the tilde, up to the first `/', if any, are
assumed to be a login name. 
...
If the login name is not found in the password file or if any quoting
or parameter substitution occurs in the login name, no substitution is
performed. 
====

I think that explains your testcases.

        -Otto

          
> 
> 
> Daniel
> 
> -- 
> LIVAI Daniel
> PGP key ID = 0x83B63A8F
> Key fingerprint = DBEC C66B A47A DFA2 792D  650C C69B BE4C 83B6 3A8F

Reply via email to