Run a script in the same directory as the current script
Since $0 holds the full path of the script that is running, you can use dirname against it to get the path of the script: #!/bin/bash script_name=$0 script_full_path=$(dirname “$0”) echo “script_name: $script_name” echo “full path: $script_full_path” so if you for example store it in /tmp/a.sh then you will see an output like: $ /tmp/a.sh script_name: … Read more