# A bad way IFS=' ' for x in $(cat $filename); do echo $x done # A better way while read x; do echo $x done < $filename
# Get directory script is run from DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"