Browse Source

Apply ShellCheck advice

Alois Mahdal 9 years ago
parent
commit
b0104f19fe

+ 1
- 1
dotfiles.config/Xlib/bin/setup View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-host=`hostname -s`
3
+host=$(hostname -s)
4
 
4
 
5
 cat<<EOF > $HOME/.Xdefaults
5
 cat<<EOF > $HOME/.Xdefaults
6
 !! This file is generated by .config/Xlib/bin/setup
6
 !! This file is generated by .config/Xlib/bin/setup

+ 12
- 12
dotfiles.config/Xlib/colorscheme/mkdemo View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path) || exit 3
3
+. "$(ffoom path)" || exit 3
4
 
4
 
5
 ffoo import pretty
5
 ffoo import pretty
6
 
6
 
18
         test -n "$name"  || continue
18
         test -n "$name"  || continue
19
         test -n "$color" || continue
19
         test -n "$color" || continue
20
         debug -v name color
20
         debug -v name color
21
-        test "$name" == "URxvt.background" && echo "$color" > $CSDEMO_BG
22
-        test "$name" == "URxvt.foreground" && echo "$color" > $CSDEMO_FG
21
+        test "$name" == "URxvt.background" && echo "$color" > "$CSDEMO_BG"
22
+        test "$name" == "URxvt.foreground" && echo "$color" > "$CSDEMO_FG"
23
         echos "        <p style='color: $color'>$name</p>"
23
         echos "        <p style='color: $color'>$name</p>"
24
     done
24
     done
25
 }
25
 }
43
     echos "body {"
43
     echos "body {"
44
     echos "    font-size: xx-large;"
44
     echos "    font-size: xx-large;"
45
     echos "    font-family: monospace;"
45
     echos "    font-family: monospace;"
46
-    echos "    color: $(cat $CSDEMO_FG);"
47
-    echos "    background-color: $(cat $CSDEMO_BG);"
46
+    echos "    color: $(cat "$CSDEMO_FG");"
47
+    echos "    background-color: $(cat "$CSDEMO_BG");"
48
     echos "}"
48
     echos "}"
49
 }
49
 }
50
 
50
 
51
 test -n "$CSDEMO_FNAME" || usage_is "scheme.Xresources"
51
 test -n "$CSDEMO_FNAME" || usage_is "scheme.Xresources"
52
 
52
 
53
-htmlhead                    >  $CSDEMO_FNAME.html
54
-cat $CSDEMO_FNAME | xd2html >> $CSDEMO_FNAME.html
55
-htmltail                    >> $CSDEMO_FNAME.html
56
-debug -f $CSDEMO_FG $CSDEMO_BG
53
+htmlhead                 >  "$CSDEMO_FNAME.html"
54
+<"$CSDEMO_FNAME" xd2html >> "$CSDEMO_FNAME.html"
55
+htmltail                 >> "$CSDEMO_FNAME.html"
56
+debug -f "$CSDEMO_FG" "$CSDEMO_BG"
57
 test -s "$CSDEMO_FG" || die "failed to parse URxvt.foreground"
57
 test -s "$CSDEMO_FG" || die "failed to parse URxvt.foreground"
58
 test -s "$CSDEMO_BG" || die "failed to parse URxvt.background"
58
 test -s "$CSDEMO_BG" || die "failed to parse URxvt.background"
59
-css                         >  $CSDEMO_FNAME.css
59
+css                         >  "$CSDEMO_FNAME.css"
60
 
60
 
61
-rm $CSDEMO_BG
62
-rm $CSDEMO_FG
61
+rm "$CSDEMO_BG"
62
+rm "$CSDEMO_FG"

+ 2
- 2
dotfiles/bash/setup View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
 put() {
3
 put() {
4
-    echo "$1" >> $HOME/.bashrc
4
+    echo "$1" >> "$HOME/.bashrc"
5
 }
5
 }
6
 
6
 
7
 mark="# added by https://github.com/AloisMahdal/mydots"
7
 mark="# added by https://github.com/AloisMahdal/mydots"
8
-if grep -qF "$mark" $HOME/.bashrc;
8
+if grep -qF "$mark" "$HOME/.bashrc";
9
 then
9
 then
10
     echo "already set up, giving up";
10
     echo "already set up, giving up";
11
     exit 1;
11
     exit 1;

+ 3
- 3
dotfiles/gittum/bin/findcat View File

1
 #!/bin/sh
1
 #!/bin/sh
2
 
2
 
3
 NAME=$1
3
 NAME=$1
4
-cat .git_$NAME 2>/dev/null \
5
-    || cat .git/gittum/$NAME 2>/dev/null \
6
-    || cat ~/.gittum/default/$NAME 2>/dev/null
4
+cat ".git_$NAME" 2>/dev/null \
5
+    || cat ".git/gittum/$NAME" 2>/dev/null \
6
+    || cat "$HOME/.gittum/default/$NAME" 2>/dev/null

+ 16
- 15
dotfiles/gittum/bin/setup View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-git_binary=`which git`
4
-
5
-if [[ -x $HOME/bin/git ]]; then
6
-    git_binary=$HOME/bin/git
7
-fi
8
-
9
-gitver=`$git_binary --version | cut -d ' ' -f 3`
10
-if [[ "$gitver" > "1.8" ]]; then
3
+git_binary=$(which git)
4
+if [[ -x "$HOME/bin/git" ]]; then
5
+    git_binary="$HOME/bin/git"
6
+gitver=$(git --version | cut -d ' ' -f 3)
7
+if [[ "x$gitver" > "x1.8" ]]; then
11
     tilde='~'
8
     tilde='~'
12
 else
9
 else
13
     tilde=$HOME
10
     tilde=$HOME
14
 fi
11
 fi
15
 
12
 
16
-host=`hostname -s`
17
-user=`whoami`
13
+host=$(hostname -s)
14
+user=$(whoami)
15
+
16
+mkconfig() {
17
+    echo "[include]"
18
+    echo "    path = $tilde/.gittum/main.gitconfig"
19
+    echo "    path = $tilde/.gittum/host/$host.gitconfig"
20
+    echo "    path = $tilde/.gittum/user/$user.gitconfig"
21
+    echo "    path = $tilde/.gittum/private.gitconfig"
22
+}
18
 
23
 
19
-printf "[include]\n" >> ~/.gitconfig
20
-printf "    path = $tilde/.gittum/main.gitconfig\n" >> ~/.gitconfig
21
-printf "    path = $tilde/.gittum/host/$host.gitconfig\n" >> ~/.gitconfig
22
-printf "    path = $tilde/.gittum/user/$user.gitconfig\n" >> ~/.gitconfig
23
-printf "    path = $tilde/.gittum/private.gitconfig\n" >> ~/.gitconfig
24
+mkconfig >>"$HOME/.gitconfig"

+ 3
- 4
dotfiles/gittum/bin/sibling View File

32
 }
32
 }
33
 
33
 
34
 usage() {
34
 usage() {
35
-    echo "usage: git $(basename $0) [-v] [-s SIBLING] [-r REMOTE] PROJECT"
35
+    echo "usage: git $(basename "$0") [-v] [-s SIBLING] [-r REMOTE] PROJECT"
36
     exit 0
36
     exit 0
37
 }
37
 }
38
 
38
 
55
 ## initz
55
 ## initz
56
 #
56
 #
57
 
57
 
58
-origin_name="origin"
59
 sibling_conf=".gittum-sibling"
58
 sibling_conf=".gittum-sibling"
60
 verbose=false
59
 verbose=false
61
 sibling=$(find -maxdepth 1 -type d -name "[^.]*" | sort | head -1)
60
 sibling=$(find -maxdepth 1 -type d -name "[^.]*" | sort | head -1)
80
 #
79
 #
81
 
80
 
82
 pushd "$sibling" >/dev/null
81
 pushd "$sibling" >/dev/null
83
-new_remote=$(rewrite_uri $remote_name $project)
82
+new_remote=$(rewrite_uri "$remote_name" "$project")
84
 popd >/dev/null
83
 popd >/dev/null
85
 
84
 
86
 test -n "$new_remote" || die "no such remote at sibling: $new_remote at $sibling"
85
 test -n "$new_remote" || die "no such remote at sibling: $new_remote at $sibling"
87
 
86
 
88
 think \'git clone $new_remote\'
87
 think \'git clone $new_remote\'
89
-git clone $new_remote
88
+git clone "$new_remote"