aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_print_mounted.fish
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2015-07-21 11:47:10 +0200
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-07-24 18:33:35 +0800
commit3925929979d0c6f57d41443472b2e2ffc89652f7 (patch)
tree2328f3caaea226f09b373840b2f70d85440c4eb5 /share/functions/__fish_print_mounted.fish
parent60fdd71f740fb594a9999c9234de6b7be1a8a458 (diff)
Fix mountpoints with spaces on linux
Signed-off-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
Diffstat (limited to 'share/functions/__fish_print_mounted.fish')
-rw-r--r--share/functions/__fish_print_mounted.fish4
1 files changed, 3 insertions, 1 deletions
diff --git a/share/functions/__fish_print_mounted.fish b/share/functions/__fish_print_mounted.fish
index 482559a8..6c7852fa 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