X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=06523f6f690c21120e164f4310458ad039b0b404;hb=81d9fc2095becd2f56beac52989807b55936f815;hp=30922f7bdf12040ee09fb9e45120188f3c7b1092;hpb=bcd36cbf23f304406b7541406492dc8fc317aaf7;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 30922f7..06523f6 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -332,14 +332,20 @@ fi # GRML_WARN_SKEL # this function checks if a command exists and returns either true # or false. This avoids using 'which' and 'whence', which will # avoid problems with aliases for which on certain weird systems. :-) +# Usage: check_com [-c|-g] word +# -c only checks for external commands +# -g does the usual tests and also checks for global aliases check_com() { - local -i comonly + local -i comonly gatoo if [[ ${1} == '-c' ]] ; then (( comonly = 1 )) shift + elif [[ ${1} == '-g' ]] ; then + (( gatoo = 1 )) else (( comonly = 0 )) + (( gatoo = 0 )) fi if (( ${#argv} != 1 )) ; then @@ -360,6 +366,10 @@ check_com() { return 0 fi + if (( gatoo > 0 )) && [[ -n ${galiases[$1]} ]] ; then + return 0 + fi + return 1 }