• Home
  • LinuxBash
  • Passing a script the directory where it is stored in

Passing a script the directory where it is stored in

This is very useful in scripts where you have a menu to allow the script itself to be edited.

DIR=”$( cd -P “$( dirname “${BASH_SOURCE[0]}” )” && pwd )”

Source: Stackoverflow