media-delivery icon indicating copy to clipboard operation
media-delivery copied to clipboard

Fix shellcheck warnings in the scripts

Open eero-t opened this issue 3 years ago • 2 comments

Pre-condition:

  • sudo apt install shellcheck or dnf install shellcheck

There are quite a few shell scripts:

find -name '*.*sh' | wc -l
38

And they trigger a lot of shellcheck warnings:

find -name '*.*sh' | xargs shellcheck | grep SC[0-9]*: | wc -l
658

Note: one should not follow shellcheck recommendations blindly. Main one where one could screw up is changing this:

base_opts="-a -b -c"
command $base_opts -d -e -f

To:

base_opts="-a -b -c"
command "$base_opts" -d -e -f

My preferred way is just adding shellcheck override for them, or switching to helper function like this:

run_command () {
   command -a -b -c $*
}
run_command -d -e -f

Whichever makes more sense for given code.

eero-t avatar Oct 06 '22 13:10 eero-t

@dvrogozh any comments on this?

eero-t avatar Aug 21 '23 09:08 eero-t

This issue is where help is clearly wanted. This task is in a backlog, but I can't say when we will have a chance to look into it ourselves.

dvrogozh avatar Aug 31 '23 17:08 dvrogozh