Scripting
Pedram Ashofteh Ardakani (IPM)
14 June 2023
There are several reasons why one might choose to use bash scripting instead of executing commands directly in the command line. Firstly, scripting allows for automation and repeatability. By writing a script, you can automate a series of tasks and ensure that they are performed consistently each time the script is run. Additionally, scripting enables you to more easily share and collaborate on complex commands or workflows with others. Gnuastro has a good astronomy-oriented tutorial on bash scripting (see here) in its manual. In terms of best practices for bash scripting, there are several other resources available. My personal suggestion is the exercism platform which provides various online challenges while giving access to human mentors and code-reviewers completely free. The GitLab documentation also provides some useful tips for writing effective bash scripts, including keeping your scripts simple and modular, testing your scripts thoroughly before using them in production environments, and using tools like shellcheck to identify potential syntax errors or other issues in your scripts. Overall, while there are certainly benefits to executing commands directly in the command line, bash scripting can be a powerful tool for automating complex tasks and ensuring consistency in your workflows. With resources like those mentioned above, you can learn to write effective scripts that follow best practices and improve your productivity as a developer. This session is based on SMACK4 which uses Gnuastro (already presented in the IPM OAM, see here) for the simple job of selecting a bright and red galaxy from the ABYSS HUDF WFC3/IR project.
Resources: