I obtain the directory of the current file using this code:
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
I would like to go down one level in the file structure.
For instance if my file is at:
/a/b/c/myFile.sh
dir
will be /a/b/c
I would like to go to /a/b
So I am running this command:
containingdir = "$( cd "$dir" && cd ".." && pwd )"
However, I'm getting this error on the line where I defined the command:
myFile.sh: line 13: containingdir: command not found
What's the cause of this error?