if [ "`echo $0 | cut -c1`" = "/" ]; then
filepath=`dirname "$0"`
else
filepath=`pwd`/`echo "$0"`
filepath=`dirname "$filepath" | sed -e 's/\/\.\//\//g'`
fi
cd $filepath
if [ "`echo $0 | cut -c1`" = "/" ]; then
filepath=`dirname "$0"`
else
filepath=`pwd`/`echo "$0"`
filepath=`dirname "$filepath" | sed -e 's/\/\.\//\//g'`
fi
cd $filepath