I would like to know why in order to get current directory from within a script we need to use solution such as:
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
taken from here.
Instead of something like:
DIR=$("pwd")
Once I have current directory of current script, and I want to calculate its
parent's parent parent
directory path, how do I do that? In terminal its simplycd ../../../
, how this can be caluclated onDIR
and assigned to a new variable?What is the difference in bash assignment between
NUM:=1
andNUM=1
Cheers