Fixed minor bugs in gnu-utils plugin.

This commit is contained in:
Sorin Ionescu 2011-07-28 19:34:21 -04:00
parent 9662a4d43b
commit 6324fcf7f1

View file

@ -6,7 +6,7 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if (( ${+commands[gwhoami]} )); then if (( $+commands[gwhoami] )); then
function __gnu_utils() { function __gnu_utils() {
emulate -L zsh emulate -L zsh
local gcmds local gcmds
@ -30,17 +30,16 @@ if (( ${+commands[gwhoami]} )); then
'gwhoami' 'gyes') 'gwhoami' 'gyes')
# Not part of coreutils, installed separately. # 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 # This method allows for builtin commands to be primary but it's
# lost if hash -r or rehash -f is executed. Thus, those two # lost if hash -r or rehash -f is executed. Thus, those two
# functions have to be wrapped. # functions have to be wrapped.
# #
if (( ${+commands[$gcmd]} )); then if (( $+commands[$gcmd] )); then
hash "${gcmd[2,-1]}"="${commands[$gcmd]}" hash "$gcmd[2,-1]"="$commands[$gcmd]"
unhash "$gcmd"
fi fi
done done
@ -49,7 +48,7 @@ if (( ${+commands[gwhoami]} )); then
__gnu_utils; __gnu_utils;
function hash() { function hash() {
if [[ "$*" =~ "-(r|f)" ]]; then if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then
builtin hash "$@" builtin hash "$@"
__gnu_utils __gnu_utils
else else