A set of helpful bash snippets to help with learning bash
There are a few examples of user input in user_input.sh
. This can be run by entering the following on the cmdline.
]$ bash user_input.sh <arg1> <arg2>
The ability to control the flow of the code in bash is critical. Examples of while/until/for loops as well as if/case statements can befound in flowcontrol.sh
. This can be run by entering the follwoing ont he cmdline.
]$ bash flowcontrol.sh <arg1>
A good example of basic file io operations can be found in fileio.sh
. This can be run by enterining the follwoing on the cmdline. Be sure to look at the contents of mypoem & example files.
]$ bash fileio.sh
Bash really doesn't have modules, but you can import one bash file into another. Lets look at this plus functions and variable scope. The files modules_functions.sh
and modules
should help with this. Try running the following on the cmdline.
]$ bash modules_functions.sh
Bash allows for integer math. Lets look at some examples in math.sh
.
]$ bash math.sh
Sometime we need the ability to group data. Lets look at the examples in array.sh
.
]$ bash array.sh