Browse Source

Stop littering; use `local` where possible

Alois Mahdal 10 years ago
parent
commit
cb19fe06c8
1 changed files with 10 additions and 10 deletions
  1. 10
    10
      dotfiles/bash/post.bashrc

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

@@ -9,8 +9,8 @@
9 9
 ### '''' ###
10 10
 
11 11
 __make_ps1d() {
12
-    rvfile="/var/tmp/bash-rv/$$.lastrv"
13
-    lastrv=$(cat $rvfile)
12
+    local rvfile="/var/tmp/bash-rv/$$.lastrv"
13
+    local lastrv=$(cat $rvfile)
14 14
     if [ $lastrv -gt 0 ];
15 15
     then
16 16
         echo "$lastrv"
@@ -27,14 +27,14 @@ __save_rv() {
27 27
 make_ps1() {
28 28
     # these functions must be already defined by ~/.bash/user/*.bashrc
29 29
     # and ~/.bash/host/*.bashrc
30
-    svrc='$(__save_rv $?)'
31
-    ps1u=$(make_ps1u)
32
-    ps1h=$(make_ps1h)
33
-    ps1w="$lblue\w$normal";
34
-    ps1G='$(__git_ps1 "(%s)")';
35
-    ps1g="$green$ps1G$normal";
36
-    ps1D='$(__make_ps1d)';
37
-    ps1d="$lred$ps1D$normal";
30
+    local svrc='$(__save_rv $?)'
31
+    local ps1u=$(make_ps1u)
32
+    local ps1h=$(make_ps1h)
33
+    local ps1w="$lblue\w$normal";
34
+    local ps1G='$(__git_ps1 "(%s)")';
35
+    local ps1g="$green$ps1G$normal";
36
+    local ps1D='$(__make_ps1d)';
37
+    local ps1d="$lred$ps1D$normal";
38 38
     echo "$svrc$ps1u@$ps1h:$ps1w$ps1g$ps1d\$ ";
39 39
 }
40 40