Iptables check script syntax

As diegows suggested, you can use iptables-restore, however you can use it with the --test flag to just test the configuration, rather than testing it as part of an actual installation.

iptables-restore --test [YOUR RULES AS A FILE]

Use iptables-save/iptables-restore. In my opinion, using script is a bad idea. Write your first rules from the command line, then save them with "iptables-save > file" and continue editing that file. "iptables-restore < file" is used to apply the rules. That command will check the syntax and won't apply the rules if there is an error.