Some good templates for writing codes (shell, python, etc) were provided in this post.
Specify shebang in the beginning of shell script, which tells the loader which interpreter should be called, this helps as different bashes have different syntaxes. In the following case, shebang line tells the loader to use user-preferred bash.
Add error handling: set -o errexit;, this will abort the execution of current shell script, if any command fails to be executed. When something wrong happens, this strategy helps you to locate the problem quickly, as traceback information will be highlighted at the line that the error actually occurs.
#!/usr/bin/env bash set -o errexit;
Specify shebang in the beginning of python scripts, if you want to run the script directly ./one_script.py.
Define Python source code encodings so that non-Latin characters will not disrupt the execution of a script.
#!/usr/bin/env python # coding=utf-8
This article is posted in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.