Recently, had an issue with firefox script creating a zombie because of an error. They fixed it, but then created another error since missed a space after a [, that was then corrected.

In some emails, learned about shellcheck package..

Have done some testing to check scripts, but just started.
In looking at /usr/bin on my machine, there are just under 5,000 files, but only 488 are shell scripts. So, created a little script that will run against all script files, and create an file with results.

Current version is shellcheck-dir3
#!/usr/bin/bash
if [[ "$1" != "error" && "$1" != "warning" && "$1" != "info" ]] ; then  s=style; else  s="$1"; fi
echo -n "" >/tmp/"$s"-out
for a in ./*; do file "$a" | grep -E '(/ksh script|/dash script|/sh script|Bourne|POSIX)' | cut -f 1 -d: ; done >/tmp/file-list
time while read -r line; do shellcheck -x -W 0 -S"$s" "$line"; done </tmp/file-list >>/tmp/"$s"-out

#create uniq listing of errors found?
grep "\-\- SC" </tmp/"$s"-out | sed 's/.*^//' |sort | uniq > /tmp/"$s"-summary.out
runuser -u $USER gedit /tmp/"$s"-out /tmp/"$s"-summary.out

shellcheck has 4 security levels (error, warning, info, style)
error limits the reports, but gives about 688 lines with /usr/bin.
Each lower level reports more and more suggestions.

Some errors are simple. Number of script the exit -1, but reports that exit values are suppose to be 0-255, so basically the -1 becomes 255. But some look like they might cause real issues.

Just interesting to look out. Originally used a for loop, but ran into some issues, so switch to the while that even handles files that contain spaces.

Thanks for any suggestions.