My directory structure is /local/mnt/abcd/sub 1
So inside the 'sub 1' folder, I am trying to execute the following script
SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
readlink -f $SOURCEDIR/..
it gives output as : /local/mnt/abcd/sub not /local/mnt/abcd/sub\ 1 Basically, it is not able to handle if there is a space present in the folder name. So I want to know is there any alternative to readlink or any other way we can get the absolute path