From 4b60298939ccceb5936f45dd054b3765c4547cf5 Mon Sep 17 00:00:00 2001 From: Benjamin Brombach Date: Wed, 3 Dec 2014 12:42:54 +0100 Subject: [PATCH] Fixed #157: Made 'type' command using default LANG (not system LANG) to check if function or alias. --- lib/composure.sh | 2 +- lib/helpers.bash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/composure.sh b/lib/composure.sh index beaf13a2..53f30344 100644 --- a/lib/composure.sh +++ b/lib/composure.sh @@ -235,7 +235,7 @@ draft () fi # aliases bind tighter than function names, disallow them - if [ -n "$(type -a $func 2>/dev/null | grep 'is.*alias')" ]; then + if [ -n "$(LANG=C type -t $func 2>/dev/null | grep 'alias')" ]; then printf '%s\n' "sorry, $(type -a $func). please choose another name." return fi diff --git a/lib/helpers.bash b/lib/helpers.bash index 4c39704d..eb5ea355 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -80,7 +80,7 @@ _is_function () _about 'sets $? to true if parameter is the name of a function' _param '1: name of alleged function' _group 'lib' - [ -n "$(type -a $1 2>/dev/null | grep 'is a function')" ] + [ -n "$(LANG=C type -t $1 2>/dev/null | grep 'function')" ] } _bash-it-aliases ()