Know whether the shell script contains syntax error without running the script

Solution 1:

bash -n scriptname

Although, this will check syntax, not command availability. (will not warn if script uses a command that is not installed yet)

Solution 2:

I found an online tool to check the syntax of the script. In addition to checking the script, also suggests possible corrections to avoid errors.

Check shell script online