Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: dumb completion question
- X-seq: zsh-users 11855
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: dumb completion question
- Date: Tue, 18 Sep 2007 16:00:04 +0100
- In-reply-to: <20070918144612.GA12974@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070918100642.GA20193@xxxxxxxxx> <20070918144612.GA12974@xxxxxxxxx>
Andy Spiegl wrote:
> # compdef cssh crsh
>
> local definedclusters
> definedclusters=(all www fire db mail web rest)
>
> _arguments \
> '-h[help]' \
> ...
> '*:cssh clusters:($definedclusters)'
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>
> So far so good, but if I read in the variable dynamically
> (which is what I want of course :-), like this:
> definedclusters="($(grep ^clusters $HOME/.csshrc | cut -d= -f2- 2>/dev/null)
> )"
>
> then I get _very_ strange results: after pressing TAB I don't see the content
> s
> of the variable definedclusters but stuff from my .Xdefaults and .zsh.history
> !
If you have extendedglob set, you need to qutoe '^clusters' or it will
expand to all files apart from one called clusters, so you will be
grepping all those files plus ~/.csshrc for the first file in the
directory.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author