Permalink
Browse files

Correctly interpreting symlinks

  • Loading branch information...
1 parent 3b8ca96 commit 856b34f9f52ce2e7845bf740defe876d03a02aad @lorenzo lorenzo committed Oct 15, 2011
Showing with 7 additions and 8 deletions.
  1. +7 −8 cake/console/cake
View
@@ -18,16 +18,15 @@
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#
################################################################################
-LIB=${0}
-SYM=$(readlink "$0")
+LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
-if [ ! -n "$SYM" ]
- then
- LIB=${LIB%/*}"/"
- else
- LIB=${SYM%/*}"/"
-fi
+while [ -h $LIB ]; do
+ DIR=$(dirname -- "$LIB")
+ SYM=$(readlink $LIB)
+ LIB=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
+done
+LIB=$(dirname -- "$LIB")/
APP=`pwd`
exec php -q ${LIB}cake.php -working "${APP}" "$@"

2 comments on commit 856b34f

Contributor

agarzon replied Oct 21, 2011

loading custom shells is not working any more since this file was changed

Owner

lorenzo replied Oct 21, 2011

Custom shells?

Please sign in to comment.