My Bash Scripting Cheat Sheet

My Bash Scripting Cheat Sheet

Shebang

Shebang is a combination of bash # and bang ! followed the the bash shell path. Shebang is simply an absolute path to the bash interpreter.

#! /bin/bash

Make a file executable

To make a .sh file executable only for your user, use:

chmod u+x your-file.sh

Use variables

#! /bin/bash
# A simple variable example
greeting=Hello
name=Dennis
echo $greeting $name