get script dir bash code example
Example 1: get script directory bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
Example 2: get script dir bash
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
Example 3: script dir bash
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"