bash get path of script code example
Example 1: get the path of script bash
script_dir=$(dirname "$0") #assign path of the script
working_dir=$(pwd) # assign working directory,
Example 2: bash get path of script
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
Example 3: bash script path
#!/bin/bash
Example 4: bash get path of command
type -a <command>