I've started using this tool to clean up my scripts. Testing via the web interface displays links to explanations of the errors or warnings found.
https://www.shellcheck.net/
yay -Ss shellcheck
ยง