A collection of Bash scripts/recipes. My handy guide for Bash.
- Basics - Bash basics.
- Array - Arrays in bash.
- Arithmetic - Arithmetic operations (integer and float) in bash.
- Conditional - Basic conditional expressions in bash.
- Datetime - Date time in bash.
- Function - Functions in bash.
- Loop - Different ways to loop in bash.
- Prompting user - Ways to prompt the user for inputs.
- String - String manipulation in bash.
- Variables - Variables in bash.
- Exit code conditional - Check the exit code of a command execution.
- In-place file edit - Edit the content of a file eg. change a line, remove a line, etc. Useful for dynamically changing the content of a file.
- Pretty print - Print text with color.
- Set trap - Examines the use of the
trap
command and how it is used to handle a system signal like SIGTERM and SIGINT. - Wait for TCP port - Connects to a TCP port using the
nc
command in every x seconds for n tries. - Working diretory - Get the path of a working directory.
Right now, these bash recipes are specific to MacOS.