From 3925929979d0c6f57d41443472b2e2ffc89652f7 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 21 Jul 2015 11:47:10 +0200 Subject: [PATCH] Fix mountpoints with spaces on linux Signed-off-by: David Adam --- share/functions/__fish_print_mounted.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_print_mounted.fish b/share/functions/__fish_print_mounted.fish index 482559a87..6c7852fa0 100644 --- a/share/functions/__fish_print_mounted.fish +++ b/share/functions/__fish_print_mounted.fish @@ -2,6 +2,8 @@ function __fish_print_mounted --description 'Print mounted devices' if test (uname) = Darwin mount | cut -d " " -f 1-2|tr " " \n|sed -e "s/[0-9\.]*:\//\//"|sgrep "^/" else - cat /etc/mtab | cut -d " " -f 1-2|tr " " \n|sed -e "s/[0-9\.]*:\//\//"|sgrep "^/" + # In mtab, spaces are replaced by a literal '\040' + # So it's safe to get the second "field" and then replace it + sed -e "s/[^ ]\+ \([^ ]\+\) .*/\\1/" -e "s/\\040/ /g" /etc/mtab end end