Executive Summary


General Notes


Brace Expansion

use bash range syntax for create multiple files at a time like:

touch example-{0..5}.txt

will create 5 files all at once.


General Notes

  • bash is default shell for most linux environments.
  • a shell is the user interface so you can speak to the computer through commands.
    • scripts are just a file that executes a series of these commands back2back inside of a single or multiple files.
  • .sh is the extension for bash scripts
  • lead all scripts with #!/bin/bash where bin/bash is the directory location of the bash executable / binary.
  • make sure you script is executable with chmod +x script.sh which gives the file the x flag to the operating systems which means you can execute it on the system.
  • variables are like in programming but usually
    • all caps for the name
    • and no spaces before/after the equals sign.
  • can access the inner value with $VARIABLE_NAME aka the dollar sign ($)
  • Control statements look like this
if [ $1 -gt 100]
then
    echo "that's a big number"
else
    echo "meh, that's a small number"
fi
  • -gt is “greater than”
  • $1 is the bash reference to the first value that is passed to the script.sh