commit 1f8903d1689e5f796fbe227587081d28f864cb07 Author: FRIGN <d...@frign.de> AuthorDate: Wed Sep 7 23:10:05 2016 +0200 Commit: FRIGN <d...@frign.de> CommitDate: Wed Sep 7 23:10:05 2016 +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. diff --git a/2ff b/2ff index a7a3aeb..07c7d46 100755 --- 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;