Reading time: 1 min
Directory the script is in:
# bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# linux sh (not for sourced files)
DIR="$(dirname "$(readlink -f -- "$0")")"
Change file and directory permissions:
find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;
Add arg0 to $@:
set -- arg0 "$@"