X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=c03b61435185ced591a67f16be498a8ed45936dc;hb=ebd9d165348f511fa1082f9a4c0ce341e277f131;hp=14cc6481ffaf8d40b421720a83c3649122d68656;hpb=95d0e2fdb605d14b4974a877406c990bd3a89426;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 14cc648..c03b614 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -450,36 +450,35 @@ fi check_com() { emulate -L zsh local -i comonly gatoo + comonly=0 + gatoo=0 if [[ $1 == '-c' ]] ; then - (( comonly = 1 )) - shift + comonly=1 + shift 1 elif [[ $1 == '-g' ]] ; then - (( gatoo = 1 )) - else - (( comonly = 0 )) - (( gatoo = 0 )) + gatoo=1 + shift 1 fi if (( ${#argv} != 1 )) ; then - printf 'usage: check_com [-c] \n' >&2 + printf 'usage: check_com [-c|-g] \n' >&2 return 1 fi if (( comonly > 0 )) ; then - [[ -n ${commands[$1]} ]] && return 0 + (( ${+commands[$1]} )) && return 0 return 1 fi - if [[ -n ${commands[$1]} ]] \ - || [[ -n ${functions[$1]} ]] \ - || [[ -n ${aliases[$1]} ]] \ - || [[ -n ${reswords[(r)$1]} ]] ; then - + if (( ${+commands[$1]} )) \ + || (( ${+functions[$1]} )) \ + || (( ${+aliases[$1]} )) \ + || (( ${+reswords[(r)$1]} )) ; then return 0 fi - if (( gatoo > 0 )) && [[ -n ${galiases[$1]} ]] ; then + if (( gatoo > 0 )) && (( ${+galiases[$1]} )) ; then return 0 fi