bash-scripts

Examples of Bash Scripts

CC0-1.0 License

Stars
4

bash-scripts

Examples of Bash Scripts

Basic Bash Script

Core components:

  • shebang line
  • debug modes
  • statements and variables

Core components breakdown

Bash Functions

Bash CLI

# Run Script:  
       ./cli.sh --count 5 --phrase "hello world" 

Bash Makefiles and Dockerfiles

Makefiles

Basic formula:

target : 
    recipe

Dockerfiles

Builds a container. You can read more documentation here.

To build it: docker build .

Find container id: docker image ls

docker run -it <your-id> bash

Then try out ipython and import pandas

Bash Data Structures: Lists and Hashes

Bash 4.0 and beyond have "hashes", you should check if it is available: bash --version

Note that modern cloudshell environments have version greater than 4.0, like Github codespaces and AWS Cloudshell. On OS X, you will need to brew install bash to upgrade.

Bash Lists

Bash Hashes