From 6324fcf7f11ac7e387df19ab5e774adfe69336d3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 19:34:21 -0400 Subject: [PATCH] Fixed minor bugs in gnu-utils plugin. --- plugins/gnu-utils/gnu-utils.plugin.zsh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh index 9505cb8..23a9b8d 100644 --- a/plugins/gnu-utils/gnu-utils.plugin.zsh +++ b/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -6,7 +6,7 @@ # ------------------------------------------------------------------------------ -if (( ${+commands[gwhoami]} )); then +if (( $+commands[gwhoami] )); then function __gnu_utils() { emulate -L zsh local gcmds @@ -30,17 +30,16 @@ if (( ${+commands[gwhoami]} )); then 'gwhoami' 'gyes') # Not part of coreutils, installed separately. - gcmds+=('gsed' 'gtar' 'gtime') + gcmds+=('ggrep' 'gsed' 'gtar' 'gtime') - for gcmd in "${gcmds[@]}"; do + for gcmd in "$gcmds[@]"; do # # This method allows for builtin commands to be primary but it's # lost if hash -r or rehash -f is executed. Thus, those two # functions have to be wrapped. # - if (( ${+commands[$gcmd]} )); then - hash "${gcmd[2,-1]}"="${commands[$gcmd]}" - unhash "$gcmd" + if (( $+commands[$gcmd] )); then + hash "$gcmd[2,-1]"="$commands[$gcmd]" fi done @@ -49,7 +48,7 @@ if (( ${+commands[gwhoami]} )); then __gnu_utils; function hash() { - if [[ "$*" =~ "-(r|f)" ]]; then + if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then builtin hash "$@" __gnu_utils else