How to write idempotent Bash scripts (2019)
A better approach is to avoid writing bash scripts. They're just too dangerous, even with "strict mode" (<a href="http://redsymbol.net/articles/unofficial-bash-strict-mode/" rel="nofollow">http://redsymbol.net/articles/unofficial-bash-strict-mode/</a>).<p>Better to use Python, or Ruby, or a Rust or Go executable.