Browse Source

Apply ShellCheck advice

Alois Mahdal 9 years ago
parent
commit
6e128ebffd

+ 2
- 2
src/bin/saturnin.skel View File

40
 }
40
 }
41
 
41
 
42
 version_info() {
42
 version_info() {
43
-    echo "$(basename $0) (Smart and ready desktop helper) $SATURNIN_VERSION"
44
-    exit $FFOO_EXIT_OK
43
+    echo "$(basename "$0") (Smart and ready desktop helper) $SATURNIN_VERSION"
44
+    exit "$FFOO_EXIT_OK"
45
 }
45
 }
46
 
46
 
47
 while true; do case $1 in
47
 while true; do case $1 in

+ 2
- 3
src/ffoo/saturnin_meta.sh View File

36
         warn "unknown subcommand, ignoring hook: $hname"
36
         warn "unknown subcommand, ignoring hook: $hname"
37
         return 0
37
         return 0
38
     }
38
     }
39
-    hook_code="$(inigrep -j -p hook.$SATURNIN_SUBCOMMAND.$hname)"
39
+    hook_code="$(inigrep -j -p "hook.$SATURNIN_SUBCOMMAND.$hname")"
40
     debug -v SATURNIN_SUBCOMMAND hook_code hname
40
     debug -v SATURNIN_SUBCOMMAND hook_code hname
41
     bash -n <<<"$hook_code" || {
41
     bash -n <<<"$hook_code" || {
42
         warn "syntax errors, ignoring hook: $hname"
42
         warn "syntax errors, ignoring hook: $hname"
46
 }
46
 }
47
 
47
 
48
 saturnin_runsc() {
48
 saturnin_runsc() {
49
-    local sc_es=0   # future exit (return) status
50
     local lexpath="$SATURNIN_LIBEXEC/saturnin-$SATURNIN_SUBCOMMAND"
49
     local lexpath="$SATURNIN_LIBEXEC/saturnin-$SATURNIN_SUBCOMMAND"
51
     debug -v lexpath
50
     debug -v lexpath
52
     debug "\$*='$*'"
51
     debug "\$*='$*'"
53
     test -x "$lexpath" || {
52
     test -x "$lexpath" || {
54
         warn "invalid sub-command: $SATURNIN_SUBCOMMAND"
53
         warn "invalid sub-command: $SATURNIN_SUBCOMMAND"
55
         saturnin_help
54
         saturnin_help
56
-        return $FFOO_EXIT_USAGE
55
+        return "$FFOO_EXIT_USAGE"
57
     }
56
     }
58
     "$lexpath" "$@"
57
     "$lexpath" "$@"
59
 }
58
 }

+ 5
- 5
src/ffoo/saturnin_urimagic.sh View File

28
     #
28
     #
29
     local d=$(mktemp -d -t saturnin_urimagic.XXXXXXXX)
29
     local d=$(mktemp -d -t saturnin_urimagic.XXXXXXXX)
30
     local p=__saturnin_urimagic__
30
     local p=__saturnin_urimagic__
31
-    pushd $d >&/dev/null
31
+    pushd "$d" >&/dev/null
32
         ##
32
         ##
33
         # heat up and fill pipes
33
         # heat up and fill pipes
34
         #
34
         #
55
             cat uris_from_kws
55
             cat uris_from_kws
56
         } | grep .  # throw away empties; add missing LF
56
         } | grep .  # throw away empties; add missing LF
57
     popd >&/dev/null
57
     popd >&/dev/null
58
-    rm -rf $d
58
+    rm -rf "$d"
59
 }
59
 }
60
 
60
 
61
 __saturnin_urimagic__deref() {
61
 __saturnin_urimagic__deref() {
72
         debug -v kw query
72
         debug -v kw query
73
         if test -n "$query";
73
         if test -n "$query";
74
         then
74
         then
75
-            local fmt=$(inigrep -j -1 -p $pfxN.${kw,,})
75
+            local fmt=$(inigrep -j -1 -p "$pfxN.${kw,,}")
76
             debug -v fmt
76
             debug -v fmt
77
             printf "$fmt\n" "$query"
77
             printf "$fmt\n" "$query"
78
         else
78
         else
79
-            inigrep -j -1 -p $pfx0.$kw
79
+            inigrep -j -1 -p "$pfx0.$kw"
80
         fi
80
         fi
81
     done
81
     done
82
 }
82
 }
85
     #
85
     #
86
     # Hack expressions like bug = 123 out of the text
86
     # Hack expressions like bug = 123 out of the text
87
     #
87
     #
88
-    sed -e 's/(\d)\</\n/;'\
88
+    sed -e 's/(\d)\</\n/;' \
89
       | perl -ne '
89
       | perl -ne '
90
             next unless m/\b([a-zA-Z]\w*\s*=\s*\w+)\b/;
90
             next unless m/\b([a-zA-Z]\w*\s*=\s*\w+)\b/;
91
             print "$1\n";
91
             print "$1\n";

+ 16
- 16
src/ffoo/saturnin_zleep.sh View File

11
 
11
 
12
 __zleep_try_umount() {
12
 __zleep_try_umount() {
13
     local mp=$1
13
     local mp=$1
14
-    mountpoint -q $mp || return 0
15
-    umount        $mp || return 1
16
-    mount | grep  $mp && return 1
14
+    mountpoint -q "$mp" || return 0
15
+    umount        "$mp" || return 1
16
+    mount | grep  "$mp" && return 1
17
     return 0
17
     return 0
18
 }
18
 }
19
 
19
 
21
     local mp
21
     local mp
22
     for mp in $(inigrep -p iam.mounting.point);
22
     for mp in $(inigrep -p iam.mounting.point);
23
     do
23
     do
24
-        __zleep_try_umount $mp || return 1
24
+        __zleep_try_umount "$mp" || return 1
25
     done
25
     done
26
     return 0
26
     return 0
27
 }
27
 }
33
 
33
 
34
 __zleep_sudo_part_started() {
34
 __zleep_sudo_part_started() {
35
     # i.e. password prompt went ok
35
     # i.e. password prompt went ok
36
-    test -e $ZLEEP_ON_ROOT
36
+    test -e "$ZLEEP_ON_ROOT"
37
     rv=$?
37
     rv=$?
38
     debug -v rv
38
     debug -v rv
39
     return $rv
39
     return $rv
40
 }
40
 }
41
 
41
 
42
 __zleep_user_part_done() {
42
 __zleep_user_part_done() {
43
-    ! test -e $ZLEEP_ON_USER
43
+    ! test -e "$ZLEEP_ON_USER"
44
     rv=$?
44
     rv=$?
45
     debug -v rv
45
     debug -v rv
46
     return $rv
46
     return $rv
47
 }
47
 }
48
 
48
 
49
 __zleep_min_path() {
49
 __zleep_min_path() {
50
-    echo -n $(sudo env | grep ^PATH)
50
+    echo -n "$(sudo env | grep ^PATH)"
51
     echo -n :
51
     echo -n :
52
-    echo -n $(dirname $(which ffoom))
52
+    echo -n "$(dirname "$(which ffoom)")"
53
     echo -n :
53
     echo -n :
54
-    echo -n $(dirname $(which saturnin))
54
+    echo -n "$(dirname "$(which saturnin)")"
55
 }
55
 }
56
 
56
 
57
 zleep() {
57
 zleep() {
76
         SUDO_PATH=$(__zleep_min_path)   # needed while bins are still under local
76
         SUDO_PATH=$(__zleep_min_path)   # needed while bins are still under local
77
         debug -v ZLEEP_ON_USER ZLEEP_ON_ROOT SUDO_PATH
77
         debug -v ZLEEP_ON_USER ZLEEP_ON_ROOT SUDO_PATH
78
         sudo env \
78
         sudo env \
79
-            ZLEEP_ON_ROOT=$ZLEEP_ON_ROOT \
80
-            ZLEEP_ON_USER=$ZLEEP_ON_USER \
81
-            PATH=$SUDO_PATH \
79
+            ZLEEP_ON_ROOT="$ZLEEP_ON_ROOT" \
80
+            ZLEEP_ON_USER="$ZLEEP_ON_USER" \
81
+            PATH="$SUDO_PATH" \
82
             saturnin iam zleeping &
82
             saturnin iam zleeping &
83
         wait_until -t 60 __zleep_sudo_part_started    # i.e. password prompt done
83
         wait_until -t 60 __zleep_sudo_part_started    # i.e. password prompt done
84
         __zleep_user_part
84
         __zleep_user_part
85
-        rm -f $ZLEEP_ON_USER
85
+        rm -f "$ZLEEP_ON_USER"
86
     else                            ## we are child (running as root)
86
     else                            ## we are child (running as root)
87
-        touch $ZLEEP_ON_ROOT
88
-        test $(id -u) -eq 0         || die "must be root"
87
+        touch "$ZLEEP_ON_ROOT"
88
+        test "$(id -u)" -eq 0               || die "must be root"
89
         wait_until __zleep_user_part_done   || die "timeout waiting for parent"
89
         wait_until __zleep_user_part_done   || die "timeout waiting for parent"
90
         __zleep_sudo_part
90
         __zleep_sudo_part
91
-        rm -f $ZLEEP_ON_ROOT
91
+        rm -f "$ZLEEP_ON_ROOT"
92
         return $?
92
         return $?
93
     fi
93
     fi
94
 }
94
 }

+ 1
- 1
src/libexec/saturnin-au View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path)
3
+. "$(ffoom path)"
4
 
4
 
5
 ffoo import pretty
5
 ffoo import pretty
6
 
6
 

+ 12
- 14
src/libexec/saturnin-clip View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path)
3
+. "$(ffoom path)"
4
 
4
 
5
 ffoo import inigrep
5
 ffoo import inigrep
6
 ffoo import pretty
6
 ffoo import pretty
25
     #
25
     #
26
     case $1 in
26
     case $1 in
27
         primary|secondary|clipboard)
27
         primary|secondary|clipboard)
28
-            xclip -o -selection $1   2>/dev/null
28
+            xclip -o -selection "$1"   2>/dev/null
29
             ;;
29
             ;;
30
         ALL)
30
         ALL)
31
             xclip -o -selection primary   2>/dev/null
31
             xclip -o -selection primary   2>/dev/null
43
     local clipname=$1
43
     local clipname=$1
44
     mkdir -p "$STORAGE_DIR" || die "could not create directory for saving"
44
     mkdir -p "$STORAGE_DIR" || die "could not create directory for saving"
45
     local path="$STORAGE_DIR/$(date +%Y%m%d-%H%M%S.clip)"
45
     local path="$STORAGE_DIR/$(date +%Y%m%d-%H%M%S.clip)"
46
-    clipln $clipname > "$path"
46
+    clipln "$clipname" > "$path"
47
 }
47
 }
48
 
48
 
49
 lsclips() {
49
 lsclips() {
50
     #
50
     #
51
     # List clips with MIME types and hints
51
     # List clips with MIME types and hints
52
     #
52
     #
53
-    local clipname=$1
54
     local ft hint name
53
     local ft hint name
55
     test -d "$STORAGE_DIR" || return 0
54
     test -d "$STORAGE_DIR" || return 0
56
-    ls "$STORAGE_DIR/"*.clip 2>/dev/null \
55
+    find "$STORAGE_DIR" -name "*.clip" 2>/dev/null \
57
       | while read name;
56
       | while read name;
58
         do
57
         do
59
-            ft=$(file -b -i $name | cut -d\; -f1)
58
+            ft=$(file -b -i "$name" | cut -d\; -f1)
60
             case $ft in
59
             case $ft in
61
                 text/*)
60
                 text/*)
62
-                    hint=$(head -c 80 $name | tr '\n' '↵')
61
+                    hint=$(head -c 80 "$name" | tr '\n' '↵')
63
                     ;;
62
                     ;;
64
                 *)
63
                 *)
65
-                    hint=$(head -c 16 $name | hexdump -C | head -1)
64
+                    hint=$(head -c 16 "$name" | hexdump -C | head -1)
66
                     ;;
65
                     ;;
67
             esac
66
             esac
68
-            echos "$(basename $name) || $ft || $hint"
67
+            echos "$(basename "$name") || $ft || $hint"
69
         done
68
         done
70
 }
69
 }
71
 
70
 
83
     local clipname=$1
82
     local clipname=$1
84
     local name=$(pick_clip)
83
     local name=$(pick_clip)
85
     test -n "$name" || return 1
84
     test -n "$name" || return 1
86
-    cat $STORAGE_DIR/$name | xclip -i -selection $clipname
85
+    < "$STORAGE_DIR/$name" xclip -i -selection "$clipname"
87
 }
86
 }
88
 
87
 
89
 rm_clip() {
88
 rm_clip() {
90
     #
89
     #
91
     # Remove single clip of choice
90
     # Remove single clip of choice
92
     #
91
     #
93
-    local clipname=$1
94
     local name=$(pick_clip)
92
     local name=$(pick_clip)
95
     test -n "$name" || return 1
93
     test -n "$name" || return 1
96
-    rm -f $STORAGE_DIR/$name
94
+    rm -f "$STORAGE_DIR/$name"
97
 }
95
 }
98
 
96
 
99
 rm_all() {
97
 rm_all() {
102
     #
100
     #
103
     test -n "$STORAGE_DIR" || die "storage directory is unset, aborting"
101
     test -n "$STORAGE_DIR" || die "storage directory is unset, aborting"
104
     test -d "$STORAGE_DIR" || return 0
102
     test -d "$STORAGE_DIR" || return 0
105
-    find "$STORAGE_DIR" -name "*.clip" | xargs rm -f
103
+    find "$STORAGE_DIR" -name "*.clip" -print0 | xargs -0 rm -f
106
     rmdir "$STORAGE_DIR" 2>/dev/null | :
104
     rmdir "$STORAGE_DIR" 2>/dev/null | :
107
 }
105
 }
108
 
106
 
129
     *)      usage                     ;;
127
     *)      usage                     ;;
130
 esac done
128
 esac done
131
 
129
 
132
-debug "\$@='$@'"
130
+debug "\$*='$*'"
133
 debug -v clipname action
131
 debug -v clipname action
134
 
132
 
135
 case $action in
133
 case $action in

+ 3
- 4
src/libexec/saturnin-dmenu View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path)
3
+. "$(ffoom path)"
4
 
4
 
5
 ffoo import inigrep
5
 ffoo import inigrep
6
 ffoo import pretty
6
 ffoo import pretty
9
     mkusage "[-l|--lines NUM] [--split CHAR] ARGS..."
9
     mkusage "[-l|--lines NUM] [--split CHAR] ARGS..."
10
 }
10
 }
11
 
11
 
12
-numbered=false
13
 lines=10
12
 lines=10
14
 maybe_split=cat
13
 maybe_split=cat
15
 delim=" "
14
 delim=" "
41
 }
40
 }
42
 
41
 
43
 do_split() {
42
 do_split() {
44
-    cut "-d$delim" -f$field
43
+    cut "-d$delim" -f"$field"
45
 }
44
 }
46
 
45
 
47
-dmenu -b -i -l $lines $(style) "$@" | $maybe_split
46
+dmenu -b -i -l "$lines" "$(style)" "$@" | $maybe_split

+ 7
- 7
src/libexec/saturnin-iam View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path)
3
+. "$(ffoom path)"
4
 
4
 
5
 ffoo import inigrep
5
 ffoo import inigrep
6
 ffoo import pretty
6
 ffoo import pretty
17
 available_commands="afk at back gone ooo wfh undocking zleeping"
17
 available_commands="afk at back gone ooo wfh undocking zleeping"
18
 
18
 
19
 usage() {
19
 usage() {
20
-    mkusage $available_commands
20
+    mkusage "$available_commands"
21
 }
21
 }
22
 
22
 
23
 
23
 
31
     #
31
     #
32
     if=$(inigrep -p iam.using.if)
32
     if=$(inigrep -p iam.using.if)
33
     gwmac=$(arp | grep "^gateway\\>.*\\<$if\$" | tr ' ' '\n' | grep :)
33
     gwmac=$(arp | grep "^gateway\\>.*\\<$if\$" | tr ' ' '\n' | grep :)
34
-    inigrep -p iam.seeing.gw.$gwmac || echo OUT
34
+    inigrep -p "iam.seeing.gw.$gwmac" || echo OUT
35
 }
35
 }
36
 
36
 
37
 set_status() {
37
 set_status() {
39
     # set public status $1 by command in conf file
39
     # set public status $1 by command in conf file
40
     #
40
     #
41
     local what=$1
41
     local what=$1
42
-    saturnin_runhook say_$what
43
-    saturnin_runhook log_$what
42
+    saturnin_runhook "say_$what"
43
+    saturnin_runhook "log_$what"
44
 }
44
 }
45
 
45
 
46
 
46
 
119
 
119
 
120
 test -n "$cmd" || usage
120
 test -n "$cmd" || usage
121
 
121
 
122
-echo $available_commands | grep -qw "$cmd" || usage
122
+echo "$available_commands" | grep -qw "$cmd" || usage
123
 
123
 
124
 shift
124
 shift
125
 
125
 
126
-i_am_$cmd $1
126
+"i_am_$cmd" "$1"

+ 2
- 2
src/libexec/saturnin-kb View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path)
3
+. "$(ffoom path)"
4
 
4
 
5
 ffoo import inigrep
5
 ffoo import inigrep
6
 ffoo import pretty
6
 ffoo import pretty
22
     local def="$default_layout"
22
     local def="$default_layout"
23
     local nxt=$(
23
     local nxt=$(
24
         echo -e "$all\n$all" \
24
         echo -e "$all\n$all" \
25
-          | grep -m 1 -A 1 $cur \
25
+          | grep -m 1 -A 1 "$cur" \
26
           | tail -1
26
           | tail -1
27
     )
27
     )
28
     test -z "$nxt" && nxt=$def
28
     test -z "$nxt" && nxt=$def

+ 4
- 4
src/libexec/saturnin-ln View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path)
3
+. "$(ffoom path)"
4
 
4
 
5
 ffoo import inigrep
5
 ffoo import inigrep
6
 ffoo import pretty
6
 ffoo import pretty
22
     local src=$1
22
     local src=$1
23
     local dst=$2
23
     local dst=$2
24
     think "linking $src to $dst"
24
     think "linking $src to $dst"
25
-    rm -f $dst
26
-    ln -sr $src $dst
25
+    rm -f "$dst"
26
+    ln -sr "$src" "$dst"
27
 }
27
 }
28
 
28
 
29
 load() {
29
 load() {
30
-    inigrep -p ln.dir.$1 | expand_tilde
30
+    inigrep -p "ln.dir.$1" | expand_tilde
31
 }
31
 }
32
 
32
 
33
 while true; do case $1 in
33
 while true; do case $1 in

+ 12
- 12
src/libexec/saturnin-menu View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path)
3
+. "$(ffoom path)"
4
 
4
 
5
 ffoo import inigrep
5
 ffoo import inigrep
6
 ffoo import pretty
6
 ffoo import pretty
28
     mname="$SATURNIN_MENU_MNAME"
28
     mname="$SATURNIN_MENU_MNAME"
29
 
29
 
30
     # check that menu item exists
30
     # check that menu item exists
31
-    inigrep -s menu.$mname | grep -q . \
31
+    inigrep -s "menu.$mname" | grep -q . \
32
      || die "no such menu: $mname"
32
      || die "no such menu: $mname"
33
 
33
 
34
     test -n "$SATURNIN_MENU_GENERATOR" \
34
     test -n "$SATURNIN_MENU_GENERATOR" \
62
     # then for items as 'item' keys at the same place,
62
     # then for items as 'item' keys at the same place,
63
     # finally default 'generator'.
63
     # finally default 'generator'.
64
     #
64
     #
65
-    inigrep -1 -p menu.$mname.generator | grep . \
65
+    inigrep -1 -p "menu.$mname.generator" | grep . \
66
      && return 0
66
      && return 0
67
-    inigrep -p menu.$mname.item | grep -m 1 -q . \
68
-     && printf "inigrep -p menu.$mname.item" \
67
+    inigrep -p "menu.$mname.item" | grep -m 1 -q . \
68
+     && echo "inigrep -p menu.$mname.item" \
69
      && return 0
69
      && return 0
70
-    inigrep -1 -p menu._default_.generator | grep . \
70
+    inigrep -1 -p "menu._default_.generator" | grep . \
71
      && return 0
71
      && return 0
72
     return 1
72
     return 1
73
 }
73
 }
79
     # First, look for 'selector' key in menu definition,
79
     # First, look for 'selector' key in menu definition,
80
     # then a default 'selector'.
80
     # then a default 'selector'.
81
     #
81
     #
82
-    inigrep -1 -p menu.$mname.selector | grep . \
82
+    inigrep -1 -p "menu.$mname.selector" | grep . \
83
      && return 0
83
      && return 0
84
-    inigrep -1 -p menu._default_.selector | grep .
84
+    inigrep -1 -p "menu._default_.selector" | grep .
85
 }
85
 }
86
 
86
 
87
 get_select_args() {
87
 get_select_args() {
91
     # First, look for 'select_args' key in menu definition,
91
     # First, look for 'select_args' key in menu definition,
92
     # then a default 'select_args'.
92
     # then a default 'select_args'.
93
     #
93
     #
94
-    inigrep -1 -p menu.$mname.select_args | grep . \
94
+    inigrep -1 -p "menu.$mname.select_args" | grep . \
95
      && return 0
95
      && return 0
96
-    inigrep -1 -p menu._default_.select_args
96
+    inigrep -1 -p "menu._default_.select_args"
97
 }
97
 }
98
 
98
 
99
 get_consumer() {
99
 get_consumer() {
103
     # First, look for 'consumer' key in menu definition,
103
     # First, look for 'consumer' key in menu definition,
104
     # then a default 'consumer'.
104
     # then a default 'consumer'.
105
     #
105
     #
106
-    inigrep -1 -p menu.$mname.consumer | grep . \
106
+    inigrep -1 -p "menu.$mname.consumer" | grep . \
107
      && return 0
107
      && return 0
108
-    inigrep -1 -p menu._default_.consumer | grep .
108
+    inigrep -1 -p "menu._default_.consumer" | grep .
109
 }
109
 }
110
 
110
 
111
 do_generate() {
111
 do_generate() {

+ 3
- 3
src/libexec/saturnin-uris View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $(ffoom path)
3
+. "$(ffoom path)"
4
 
4
 
5
 ffoo import inigrep
5
 ffoo import inigrep
6
 ffoo import pretty
6
 ffoo import pretty
51
     *)  break ;;
51
     *)  break ;;
52
 esac done
52
 esac done
53
 
53
 
54
-debug "\$@='$@'"
54
+debug "\$*='$*'"
55
 debug -v src
55
 debug -v src
56
 
56
 
57
 case "$src" in
57
 case "$src" in
58
     args) uri="$(echo "$@" | saturnin_urimagic__scan)" ;;
58
     args) uri="$(echo "$@" | saturnin_urimagic__scan)" ;;
59
-    file) uri="$(cat "$file" | saturnin_urimagic__scan)" ;;
59
+    file) uri="$(<"$file" saturnin_urimagic__scan)" ;;
60
     xpri) uri="$(clipln pri | saturnin_urimagic__scan)" ;;
60
     xpri) uri="$(clipln pri | saturnin_urimagic__scan)" ;;
61
     xsec) uri="$(clipln sec | saturnin_urimagic__scan)" ;;
61
     xsec) uri="$(clipln sec | saturnin_urimagic__scan)" ;;
62
     xclp) uri="$(clipln clp | saturnin_urimagic__scan)" ;;
62
     xclp) uri="$(clipln clp | saturnin_urimagic__scan)" ;;

+ 11
- 12
src/libexec/saturnin-xuris View File

2
 
2
 
3
 # launch Uzbl once per each URI in stdin
3
 # launch Uzbl once per each URI in stdin
4
 
4
 
5
-. $(ffoom path) || exit 3
5
+. "$(ffoom path)" || exit 3
6
 ffoo import pretty
6
 ffoo import pretty
7
 
7
 
8
 SATURNIN_XURIS_NOTIFICATIONS=true
8
 SATURNIN_XURIS_NOTIFICATIONS=true
65
 
65
 
66
 open_from() {
66
 open_from() {
67
     local list="$1"
67
     local list="$1"
68
-    local count=$(wc -l <$list)
68
+    local count=$(wc -l <"$list")
69
 
69
 
70
-    test $count -gt $SATURNIN_XURIS_LIMIT && {
70
+    test "$count" -gt $SATURNIN_XURIS_LIMIT && {
71
         notify "too much URIs; giving up: $count > $SATURNIN_XURIS_LIMIT"
71
         notify "too much URIs; giving up: $count > $SATURNIN_XURIS_LIMIT"
72
         return 1
72
         return 1
73
     }
73
     }
74
 
74
 
75
-    test $count -eq 0 && {
75
+    test "$count" -eq 0 && {
76
         $SATURNIN_XURIS_ALWAYS_RUN && $SATURNIN_XURIS_BIN &
76
         $SATURNIN_XURIS_ALWAYS_RUN && $SATURNIN_XURIS_BIN &
77
         return 0
77
         return 0
78
     }
78
     }
79
 
79
 
80
-    cat $list \
81
-      | while read uri;
82
-        do
83
-            $SATURNIN_XURIS_BIN "$uri" &
84
-        done
80
+    while read uri;
81
+    do
82
+        $SATURNIN_XURIS_BIN "$uri" &
83
+    done < "$list"
85
 }
84
 }
86
 
85
 
87
 while true; do case $1 in
86
 while true; do case $1 in
103
          SATURNIN_XURIS_UNIQ
102
          SATURNIN_XURIS_UNIQ
104
 
103
 
105
 SATURNIN_XURIS_URI_LIST=$(mktemp -t saturnin-xuris.XXXXXXXX)
104
 SATURNIN_XURIS_URI_LIST=$(mktemp -t saturnin-xuris.XXXXXXXX)
106
-cat | maybe_uniq | grep . >$SATURNIN_XURIS_URI_LIST
105
+cat | maybe_uniq | grep . >"$SATURNIN_XURIS_URI_LIST"
107
 
106
 
108
 # choice of URI has been made; we may try to use dmenu
107
 # choice of URI has been made; we may try to use dmenu
109
 bash -n <<<"$SATURNIN_XURIS_CHOICE"
108
 bash -n <<<"$SATURNIN_XURIS_CHOICE"
112
 
111
 
113
 debug -v SATURNIN_XURIS_BIN
112
 debug -v SATURNIN_XURIS_BIN
114
 
113
 
115
-open_from $SATURNIN_XURIS_URI_LIST
116
-rm $SATURNIN_XURIS_URI_LIST
114
+open_from "$SATURNIN_XURIS_URI_LIST"
115
+rm "$SATURNIN_XURIS_URI_LIST"

+ 1
- 2
tests/TF_HEADER View File

1
 #!/bin/sh
1
 #!/bin/sh
2
 
2
 
3
-echo -n "version: ";
4
-saturnin --version-semver
3
+echo "version: $(saturnin --version-semver)"

+ 2
- 2
tests/cli/TF_RUN View File

1
 #!/bin/bash
1
 #!/bin/bash
2
 
2
 
3
-. $TF_DIR/include/subtest.sh
4
-. $TF_DIR/include/tools.sh
3
+. "$TF_DIR/include/subtest.sh"
4
+. "$TF_DIR/include/tools.sh"
5
 
5
 
6
 tf_enum_subtests() {
6
 tf_enum_subtests() {
7
     echo usage
7
     echo usage