[hackers] [farbfeld] Shellcheck 2ff fixes || FRIGN

From: <git_AT_suckless.org>
Date: Wed, 7 Sep 2016 23:11:12 +0200 (CEST)

commit 1f8903d1689e5f796fbe227587081d28f864cb07
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Wed Sep 7 23:10:05 2016 +0200
Commit: FRIGN <dev_AT_frign.de>
CommitDate: Wed Sep 7 23:10:05 2016 +0200

    Shellcheck 2ff fixes
    
    I was inspired by the current discussion on dev_AT_ 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.

diff --git a/2ff b/2ff
index a7a3aeb..07c7d46 100755
--- a/2ff
+++ b/2ff
_AT_@ -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;
Received on Wed Sep 07 2016 - 23:11:12 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 07 2016 - 23:12:23 CEST