2 ################################################################################
4 # Cake is a shell script for invoking CakePHP shell commands
6 # CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
7 # Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
9 # Licensed under The MIT License
10 # For full copyright and license information, please see the LICENSE.txt
11 # Redistributions of files must retain the above copyright notice.
13 # @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
14 # @link http://cakephp.org CakePHP(tm) Project
16 # @license http://www.opensource.org/licenses/mit-license.php MIT License
18 ################################################################################
20 # Canonicalize by following every symlink of the given name recursively
25 DIR=$(dirname -- "$NAME")
26 NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME")
28 while [ -h "$NAME" ]; do
29 DIR=$(dirname -- "$NAME")
30 SYM=$(readlink "$NAME")
31 NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && pwd)/$(basename -- "$SYM")
36 CONSOLE=$(dirname -- "$(canonicalize "$0")")
37 APP=$(dirname "$CONSOLE")
39 if [ $(basename $0) != 'cake' ]
41 exec php "$CONSOLE"/cake.php $(basename $0) "$@"
43 exec php "$CONSOLE"/cake.php "$@"