FELIX-1459: bin/karaf may fail to start when CDPATH is set (on posix shells)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@801926 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/assembly/src/main/distribution/unix-shell/bin/karaf b/karaf/assembly/src/main/distribution/unix-shell/bin/karaf
index 8a5c898..1a1d90b 100755
--- a/karaf/assembly/src/main/distribution/unix-shell/bin/karaf
+++ b/karaf/assembly/src/main/distribution/unix-shell/bin/karaf
@@ -111,6 +111,9 @@
     if [ "x$KARAF_HOME" != "x" ]; then
         warn "Ignoring predefined value for KARAF_HOME"
     fi
+    
+    # In POSIX shells, CDPATH may cause cd to write to stdout
+    (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
     KARAF_HOME=`cd $DIRNAME/..; pwd`
     if [ ! -d "$KARAF_HOME" ]; then