From 7401415a4c6d90c48cbe8e8d9ca6cc8539c8f3c7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 15 Aug 2011 16:17:48 -0400 Subject: IFS clobbering workaround This is not because of too much haskell programming. It's because using IFS in shell is always followed by chasing down IFS clobbering portability bugs in shell, no matter how careful you are. --- functions | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/functions b/functions index 74f0e0b..80844de 100644 --- a/functions +++ b/functions @@ -6,14 +6,15 @@ smallyes() { } in_path () { - IFS=":" _in_path "$1" -} -_in_path () { + local OLD_IFS="$IFS" + IFS=":" for dir in $PATH; do if [ -x "$dir/$1" ]; then + IFS="$OLD_IFS" return 0 fi done + IFS="$OLD_IFS" return 1 } -- cgit v0.12