瀏覽代碼

Fix quoting in bashum handlers

Alois Mahdal 8 月之前
父節點
當前提交
5c18697676
共有 1 個檔案被更改,包括 9 行新增9 行删除
  1. 9
    9
      dotfiles/config/bashum/post.bashrc

+ 9
- 9
dotfiles/config/bashum/post.bashrc 查看文件

@@ -102,13 +102,13 @@ __bashum__wdir() {
102 102
     #
103 103
     local mode=${1:-normal}
104 104
     case $mode:$PWD in
105
-        shrinky:*)              __bashum__shrinkypath "$PWD" ;;
106
-        normal:*)               echo "${PWD/$HOME/\~}" ;;
107
-        short:$HOME)            echo "~" ;;
108
-        short:$HOME/??????????) echo "${PWD/$HOME/\~}" ;;
109
-        short:$HOME/*/*)        echo "…${PWD##*/}" ;;
110
-        short:$HOME/*)          echo "${PWD/$HOME/\~}" ;;
111
-        short:*)                echo "$PWD" ;;
105
+        shrinky:*)                  __bashum__shrinkypath "$PWD" ;;
106
+        normal:*)                   echo "${PWD/$HOME/\~}" ;;
107
+        short:"$HOME")              echo "~" ;;
108
+        short:"$HOME"/??????????)   echo "${PWD/$HOME/\~}" ;;
109
+        short:"$HOME"/*/*)          echo "…${PWD##*/}" ;;
110
+        short:"$HOME"/*)            echo "${PWD/$HOME/\~}" ;;
111
+        short:*)                    echo "$PWD" ;;
112 112
     esac
113 113
 }
114 114
 
@@ -118,8 +118,8 @@ __bashum__shrinkypath() {
118 118
     #
119 119
     local path=$1
120 120
     case $path in
121
-        $HOME)      echo "~"; return ;;
122
-        $HOME/*)    echo -n "~"; __bashum__shrink_relpath "${path#$HOME/}" ;;
121
+        "$HOME")    echo "~"; return ;;
122
+        "$HOME"/*)  echo -n "~"; __bashum__shrink_relpath "${path#$HOME/}" ;;
123 123
         *)          echo "$path"; return ;;
124 124
     esac
125 125
 }