I have written a bash script that takes an input file as an argument and reads it. This file contains some paths (relative to its location) to additional files used.
This will work for both file and folder:
absPath(){ if [[ -d "$1" ]]; then cd "$1" echo "$(pwd -P)" else cd "$(dirname "$1")" echo "$(pwd -P)/$(basename "$1")" fi }