readlink not working when parameters is surrounded with double quote
I'm trying to locate the real path of the running script , but when $0 was in some folders that contains space , readlink would fail , so i surrounded $0 with " , but readlink ceased to work this time.
RPATH="$(readlink -f \"$0\")" echo $RPATH
Thanks , and if bash itself can do this , it's much more better !
Don't escape the inner quotes. As it is, they are handled to readlink as part of the filename (instead of preventing word splitting).