Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Mysterious completion of variables
- X-seq: zsh-users 9686
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Mysterious completion of variables
- Date: Fri, 18 Nov 2005 10:21:56 +0000
- In-reply-to: <b6c719b90511171236j5988236elda6ac5a4e9d37dc@xxxxxxxxxxxxxx> 
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <b6c719b90511171236j5988236elda6ac5a4e9d37dc@xxxxxxxxxxxxxx>
Ian Langworth wrote:
> I have a few variables for hosts that I shell into frequently:
> 
>   aspen='me@xxxxxxxxxxxxxxxxxx'
>   alias aspen="ssh $aspen"
> 
> Thus, I'm usually able to do the following:
> 
>   scp $aspen:temp .
> 
> This usually works, but there are occasions where I get strange
> completion after I hit <Enter>:
> 
>   cp: cannot stat `me@xxxxxxxxxxxxxxxxxxxxx': No such file or directory
> 
> Sounds like it's interpolating ':t', but I'm not sure why. Ideas?
Yes, but it's not actually completion... the syntax $aspen:t takes the
tail end of a path.  It's borrowed from history substitution.  Since
there isn't a slash in the variable it has no effect except that the :t
is swallowed up and the emp treated as normal text (because another
modifier would need another colon in front).
You need to use ${aspen}:temp or $aspen\:t to protect the :.
This feature isn't compatible with other shells.  It's turned off when
you set the KSH_ARRAYS option, but that has numerous other effects
so I wouldn't recommend that unless you really know what you're doing.
-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070
This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author