Having this structure:
At one point in my script a need to store the complete path to dir3 into a variable.
I know this works:
But, How can I store the previous one?
WARNING: I have searched for similar questions, but all include changing the current directory, which is something i want to avoid.
Edit: What I mean is, as i'm running my_script.sh, the current directory is /dir1/dir2/dir3/dir4/
I want to store in a variable just: /dir1/dir2/dir3/