diff --git a/realpath.sh b/realpath.sh index d114d30..c356e23 100755 --- a/realpath.sh +++ b/realpath.sh @@ -27,13 +27,12 @@ while [ -n "$left" ]; do case "$seg" in .) - # /foo/a -> . will become /foo - result="${result%/*}" + # Just ignore this segment continue ;; ..) - # /foo/bar/a -> .. will become /foo - result="${result%/*/*}" + # Eat a segment off result + result="${result%/*}" continue ;; esac