summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-08-15 16:17:48 -0400
committerJoey Hess <joey@kitenet.net>2011-08-15 16:17:48 -0400
commit7401415a4c6d90c48cbe8e8d9ca6cc8539c8f3c7 (patch)
tree0d5c7c6596657ef7de4105c117fc426ed4d0feb5
parent148f8aa0018ee5b6961103983ab14362f67ee847 (diff)
downloaddebootstrap-7401415a4c6d90c48cbe8e8d9ca6cc8539c8f3c7.tar.gz
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.
-rw-r--r--functions7
1 files 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
}