Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: {(t)...} usage
- X-seq: zsh-users 5058
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Mario Lang <mlang@xxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: {(t)...} usage
- Date: Sat, 15 Jun 2002 23:06:48 +0000
- In-reply-to: <87it4l7vcy.fsf@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <87it4l7vcy.fsf@xxxxxxxxxxxxxxxx>
On Jun 14, 5:06pm, Mario Lang wrote:
} Subject: {(t)...} usage
}
} ... I'd like to use a unique array, and I found
} the (t) flag in the manpages.
}
} There is just no example there, and I didnt figure out how
} to use it.
I'd like to know which manual you're reading, because the (t) flag has
nothing to do with unique arrays. It reports the -type- of a parameter
("parameter" is another word for "variable" in zsh parlance).
There is a (u) flag in the 4.1.x-dev versions, but it's not available
in zsh 4.0.x or 3.anything.
However, you're on a wild goose chase. You don't need to make the array
unique. The completion system will take care of doing that before it
offers you any choices.
} ${(t)array-unique $(grep -v "^#" /etc/hosts) ${...some_ssh_known_hosts_too})
There is so much wrong here that I don't have time even to begin to
figure out what you actually meant, never mind explaining how to fix it.
Please read Chapter 5 <http://zsh.sunsite.dk/Guide/zshguide05.html> of
Peter Stephenson's Zsh User's Guide. It explains many details of parameter
substitutions, with a lot of examples.
Meanwhile, if you don't mind simply pasting someone else's black magic
into your .zshrc file, the following will probably make your completion
work mostly the way you want:
zstyle -e ':completion:*:(ssh|scp):*' hosts 'reply=(
${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \
/dev/null)"}%%[# ]*}//,/ }
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
)'
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author