Command in bash shell script to find path to that script? Is there a command to go inside a bash .sh script that will provide the full path to the directory containing that script?
See the answers on Get the source directory of a Bash script from within the script itself. The accepted one recommends

#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &gt;/dev/null 2&gt;&amp;1 &amp;&amp; pwd )"


but reading all the answers gives a lot of alternatives (and insights into how shells work).