Skip to content

Commit

Permalink
Make trim_path() handle "/", and arbitrarily many consecutive /:es.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tails developers authored and daniel-baumann committed Apr 5, 2012
1 parent 1879d83 commit 2d12920
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/live-helpers
Expand Up @@ -519,8 +519,9 @@ where_is_mounted ()
}

trim_path () {
# remove all unnecessary /:s in the path, including last
echo ${1} | sed 's|//|/|g' | sed 's|/$||'
# remove all unnecessary /:s in the path, including last one (except
# if path is just "/")
echo ${1} | sed 's|//\+|/|g' | sed 's|^\(.*[^/]\)/$|\1|'
}

what_is_mounted_on ()
Expand Down

0 comments on commit 2d12920

Please sign in to comment.