Shellcheck 2ff fixes - farbfeld - suckless image format with conversion tools | |
git clone git://git.suckless.org/farbfeld | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 1f8903d1689e5f796fbe227587081d28f864cb07 | |
parent 3fa775e1dfd5dc38648f88c2f385be1f0fe45605 | |
Author: FRIGN <[email protected]> | |
Date: Wed, 7 Sep 2016 23:10:05 +0200 | |
Shellcheck 2ff fixes | |
I was inspired by the current discussion on dev@ to use shellcheck to | |
check my scripts and thought it might be a good choice to do this for | |
the 2ff script. | |
Not much had to be changed, because I was careful writing it, but still | |
it won't hurt to but $TMP in double quotes. | |
Diffstat: | |
M 2ff | 12 ++++++------ | |
1 file changed, 6 insertions(+), 6 deletions(-) | |
--- | |
diff --git a/2ff b/2ff | |
@@ -5,17 +5,17 @@ if [ "$#" -ne 0 ]; then | |
fi | |
TMP=$(mktemp) | |
-cat > $TMP; | |
+cat > "$TMP"; | |
-FORMAT=$(file -ib $TMP | cut -d ";" -f 1); | |
+FORMAT=$(file -ib "$TMP" | cut -d ";" -f 1); | |
case "$FORMAT" in | |
- image/png) png2ff < $TMP; ret=$? ;; | |
- image/jpeg) jpg2ff < $TMP; ret=$? ;; | |
- *) convert $TMP png:- 2>/dev/null | png2ff 2>/dev/null; ret=$? ;; | |
+ image/png) png2ff < "$TMP"; ret=$? ;; | |
+ image/jpeg) jpg2ff < "$TMP"; ret=$? ;; | |
+ *) convert "$TMP" png:- 2>/dev/null | png2ff 2>/dev/null; ret=$? ;; | |
esac | |
-rm $TMP; | |
+rm "$TMP"; | |
if [ $ret -ne 0 ]; then | |
printf "%s: failed to convert %s\n" "$0" "$FORMAT" >&2; |