Avoid some unnecessary stat calls.

This commit is contained in:
Ville Skyttä 2011-02-05 12:06:53 +02:00
parent b8ad998923
commit 6aecdb5f4c
3 changed files with 8 additions and 5 deletions

View File

@ -60,7 +60,7 @@ _java_classes()
cur=${cur//.//}
# parse each classpath element for classes
for i in ${classpath//:/ }; do
if [[ -r $i && "$i" == *.@(jar|zip) ]]; then
if [[ "$i" == *.@(jar|zip) && -r $i ]]; then
if type zipinfo &>/dev/null; then
COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
"$i" "$cur*" 2>/dev/null | \

View File

@ -37,8 +37,11 @@ _muttrc()
done
if [ -z "$muttrc" ]; then
[ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
[ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
if [ -f ~/.${muttcmd}rc ]; then
muttrc="~/.${muttcmd}rc"
elif [ -f ~/.${muttcmd}/${muttcmd}rc ]; then
muttrc="~/.${muttcmd}/${muttcmd}rc"
fi
fi
printf "%s" "$muttrc"
} # _muttrc()

View File

@ -19,11 +19,11 @@ _service()
# don't complete past 2nd token
[ $COMP_CWORD -gt 2 ] && return 0
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
if [[ $COMP_CWORD -eq 1 && $prev == "service" ]]; then
_services
else
[ -d /etc/rc.d/init.d ] && \
sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
-ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
$sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )