Get current directory from within the bash script:
#linux #bash #script #shell #pwd #current_directory
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
echo "$SCRIPT_DIR"
dirname
gets the current directory and cd
will change the current directory, finally pwd
will return the current working directory, which in our case will be stored in SCRIPT_DIR
.#linux #bash #script #shell #pwd #current_directory