Debug scripts from command line with Zend Debugger

Usage:

~/cli_zend_debug.sh script.php <param1> <param..>

Source of cli_zend_debug.sh

#!/bin/bash

IP=`who am i | sed -r "s/.*\((.*)\).*/\\1/"`
PORT=10137

CHECK_PORT=`nc -t $IP $PORT < /dev/null; echo $?`

if [ $CHECK_PORT -ne 0 ]; then
	echo "Cannot connect to $IP:$PORT"
	exit 1
fi

PHP_IDE_CONFIG## "serverNameCLI" QUERY_STRING## "start_debug1&debug_host## $IP&use_remote1&debug_port## $PORT&debug_stop1&debug_fastfile## 1&original_urlhttp://cli.devil&debug_session_id=10000" /usr/local/bin/php "$@"