Run scripts through shellcheck
milnak opened this issue · comments
sudo apt install shellcheck
You can then do a sanity check on scripts, e.g.
In flip_hori.sh line 18:
height=$(grep "^height" $1/lemonlauncher.conf| sed "s/ //g" | cut -d"=" -f2)
^-- SC2086: Double quote to prevent globbing and word splitting.
In flip_hori.sh line 39:
video_y1_180=$(( $height - $video_y2))
^-- SC2004: $/${} is unnecessary on arithmetic variables.
^-- SC2004: $/${} is unnecessary on arithmetic variables.
autostart.sh fails check because it seems there's a trailing "fi" in the file? Removing that and running shellcheck shows results, e.g.
In autostart.sh line 306:
M4ALLHOME=/usr/local/share/mame4all-pi
^-- SC2034: M4ALLHOME appears unused. Verify it or export it.
In autostart.sh line 365:
echo `date +%T_%F` $1
^-- SC2046: Quote this to prevent word splitting.
^-- SC2006: Use $(..) instead of legacy `..`.
^-- SC2086: Double quote to prevent globbing and word splitting.
i fixed this in the dev branch