cc:  [email protected]
Subject: Re: Re: [ast-users] [ksh93] Should ~$user be tilde expanded?
--------

> This make sense but ksh's behavior indicates that it makes two-pass parsing
> for ~$u, rather than one-pass from beginning to end. For a one-pass
> parsing, when it sees the ~ char and peeks at the next $ char it'll tell
> that tilde expansion is not possible; then it'll move forward and get the $
> char and peeks at the next u char and it will know that parameter expansion
> is needed.
> 
> 

If the ~ is followed by a $, it does the $ expansion before doing
the ~ expansion.  It does this in a single pass.
I think that the standard is ambiguous so that both implementations
conform to POSIX although I think that the ksh93 (and ksh88 upon
which the POSIX tilde expansion is based) is more useful.  You can
do things like.

        for name in foo bar bam
        do      cd ~$name
                ...
        done

Otherwise this would require an eval.

David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to