Fixed real path resolution in BASH script (GNU-compliant)