ShellScript to get full path of itself

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
pushd `dirname $0` > /dev/null
SELFPATH=`pwd -P`
popd > /dev/null
echo $SELFPATH