Is it possible to check a bash script syntax without executing it?
Using Perl, I can run perl -c \'script name\'. Is there any equivalent command for ba
sh -n script-name
Run this. If there are any syntax errors in the script, then it returns the same error message.
If there are no errors, then it comes out without giving any message. You can check immediately by using echo $?, which will return 0 confirming successful without any mistake.
It worked for me well. I ran on Linux OS, Bash Shell.