Home πŸ‡ΊπŸ‡¦ Support Ukraine

Shell Cheatsheet

Created: 2019-10-03

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 "$@"