Commit eacceac
authored
Use shellcheck and shfmt to format install script (gobackup#286)
While trying to use the project's install script, I noticed that the
install script could use some optimization, so I formatted the script
with [shfmt](https://github.com/mvdan/sh), as well as eliminating
several warnings generated by
[shellcheck](https://github.com/koalaman/shellcheck).
Here is the output of shellcheck on the install script before this
commit,
```
$ shellcheck install
In install line 10:
local repo="$1"
^--------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
In install line 27:
platform="$(uname | tr "[A-Z]" "[a-z]")" # Linux => linux
^-----^ SC2021 (info): Don't use [] around classes in tr, it replaces literal square brackets.
^-----^ SC2021 (info): Don't use [] around classes in tr, it replaces literal square brackets.
In install line 36:
trap "rm -r ${tmp_dir}" EXIT
^--------^ SC2064 (warning): Use single quotes, otherwise this expands now rather than when signalled.
In install line 50:
if test $(id -u) -eq 0; then
^------^ SC2046 (warning): Quote this to prevent word splitting.
For more information:
https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
https://www.shellcheck.net/wiki/SC2064 -- Use single quotes, otherwise this...
https://www.shellcheck.net/wiki/SC3043 -- In POSIX sh, 'local' is undefined.
```1 parent 3aeb4c6 commit eacceac
1 file changed
+11
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | | - | |
11 | | - | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | | - | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | | - | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | | - | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
50 | | - | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
0 commit comments