Skip to content

jeffmlpsi/bash_cheatsheets

Repository files navigation

bash_cheatsheets

A set of helpful bash snippets to help with learning bash

Basic User Input

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>

Flow Control

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>

File Input & Output

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

Functions & Modules

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

Math

Bash allows for integer math. Lets look at some examples in math.sh.

]$ bash math.sh

Arrays

Sometime we need the ability to group data. Lets look at the examples in array.sh.

]$ bash array.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages