Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
completion for (u)mount
- X-seq: zsh-users 1238
- From: Stefan Monnier <monnier+lists/zsh/users/news/@TEQUILA.SYSTEMSZ.CS.YALE.EDU>
- To: zsh-users@xxxxxxxxxxxxxxx
- Subject: completion for (u)mount
- Date: 19 Jan 1998 23:33:29 -0500
- Sender: monnier@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
I just hacked up comletion for mount and umount on Linux. I figured some
completion fanatics might like it.
Stefan
comp_fsmount () {
local tmp; if [[ $UID = 0 ]]; then tmp=""; else tmp="user"; fi
sed -n -e "s|^[^# ][^ ]*[ ][ ]*\(/[^ ]*\)[
].*$tmp.*|\1|p" /etc/fstab # beware the tabs
}
comp_nfsmount () {
local cmd args host
read -Ac cmd; read -cn where
host=${${cmd[$where]}%%:*}
reply=("${(@f)$(showmount -e $host | sed -n -e "s|^/\([^ ]*\) .*|$host:/\1|p")}")
}
compctl -s '$(mount | \
sed -e "s/^[^ ]* on \\([^ ]*\\) type.*/\\1/"'"$(
if [[ ! $UID = 0 ]]; then
echo ' | egrep "^${(j:|:)$(comp_fsmount)}\$"'
fi)"')' umount
compctl -s '$(comp_fsmount)' + \
-x 'S[/]' -f -- + \
-x 'C[0,*:*]' -K comp_nfsmount -- + \
-s '$(< /etc/hosts)' \
mount
Messages sorted by:
Reverse Date,
Date,
Thread,
Author