From 2d129205223e1fb6322bb03a9cb9fdf1736885b8 Mon Sep 17 00:00:00 2001 From: Tails developers Date: Tue, 20 Mar 2012 17:36:18 +0100 Subject: Make trim_path() handle "/", and arbitrarily many consecutive /:es. --- scripts/live-helpers | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/live-helpers b/scripts/live-helpers index 1f2fb80..75fc106 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -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 () -- cgit v1.2.3