I’d recommend installing Shellcheck and an associated plugin for your editor of choice. I have the plugin installed for VS Code and open the link presented to me when I do anything “wrong” as it’ll give a good explanation for the “better/more correct” way of doing things.