Browse Source

Apply ShellCheck hints

Alois Mahdal 8 years ago
parent
commit
4e992fa8a3
2 changed files with 5 additions and 5 deletions
  1. 1
    1
      dotfiles/bash/head.bashrc
  2. 4
    4
      dotfiles/bash/post.bashrc

+ 1
- 1
dotfiles/bash/head.bashrc View File

@@ -9,5 +9,5 @@ for include in \
9 9
   "${HOME}/.bash/host/$(hostname -s).bashrc" \
10 10
   "${HOME}/.bash/post.bashrc";
11 11
 do
12
-  test -f $include && . $include;
12
+  test -f "$include" && . "$include";
13 13
 done

+ 4
- 4
dotfiles/bash/post.bashrc View File

@@ -10,21 +10,21 @@
10 10
 
11 11
 __make_ps1d() {
12 12
     local rvfile="$RV_TMP/$$.lastrv"
13
-    local lastrv=$(cat $rvfile)
13
+    local lastrv="$(cat "$rvfile")"
14 14
     local do_rm=false
15 15
     test "$1" == "-r" && do_rm=true
16
-    if [ 0$lastrv -gt 0 ];
16
+    if [ "0$lastrv" -gt 0 ];
17 17
     then
18 18
         echo "!$lastrv!"
19 19
     else
20 20
         echo ""
21 21
     fi
22
-    $do_rm && rm -f $rvfile
22
+    $do_rm && rm -f "$rvfile"
23 23
 }
24 24
 
25 25
 __save_rv() {
26 26
     local rvfile="$RV_TMP/$$.lastrv"
27
-    [ -w ${rvfile%/*} ] && echo $1 > $rvfile
27
+    [ -w "${rvfile%/*}" ] && echo "$1" > "$rvfile"
28 28
 }
29 29
 
30 30
 make_ps1() {