diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-31 22:12:16 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-31 22:12:16 +1300 |
commit | 5d116c86aea19670147a7f0c0c95a18b5444a3a2 (patch) | |
tree | fcaa177930a8cb9a916e06b9f22c6ffef899992d | |
parent | Correct copypaste errors in `check-bin`, `lint-bin` (diff) | |
download | dotfiles-5d116c86aea19670147a7f0c0c95a18b5444a3a2.tar.gz dotfiles-5d116c86aea19670147a7f0c0c95a18b5444a3a2.zip |
Apply stable check and lint methods to games shell
This applies the same stable approach to testing the actual built
games that are shebannged with #!/bin/sh as has been applied to the
shell scripts in the `check-bin` and `lint-bin` targets.
There are no GNU Bash games in these directories, so the latter block of
code from the `bin` analogues to check or lint those is not needed.
The same applies here; this is not as complete a checking or linting of
the games directory as it could be; ideally we would check the sed(1)
and awk(1) scripts too.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | check/games.sh | 5 | ||||
-rw-r--r-- | lint/games.sh | 8 |
3 files changed, 11 insertions, 4 deletions
@@ -541,7 +541,7 @@ check-bash: check-bin: $(BINS) sh check/bin.sh -check-games: +check-games: $(GAMES) sh check/games.sh check-man: diff --git a/check/games.sh b/check/games.sh index 79d53ed5..7d1c3694 100644 --- a/check/games.sh +++ b/check/games.sh @@ -1,4 +1,5 @@ +# POSIX sh for game in games/*.sh ; do - sh -n "$game" || exit + sh -n -- "${game%.sh}" || exit done -printf 'All shell scripts in games parsed successfully.\n' +printf 'sh(1) games parsed successfully.\n' diff --git a/lint/games.sh b/lint/games.sh index 6e3e3024..fa2c7a97 100644 --- a/lint/games.sh +++ b/lint/games.sh @@ -1 +1,7 @@ -find games -type f -name '*.sh' -print -exec shellcheck -e SC1090 -s sh -- {} + +# POSIX sh +set -- +for game in games/*.sh ; do + set "$@" "${game%.sh}" +done +shellcheck -e SC1090 -- "$@" || exit +printf 'sh(1) games linted successfully.\n' |