Executive Summary
- good resource: Bash Hackers Wiki
General Notes
Brace Expansion
use bash range syntax for create multiple files at a time like:
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 thex
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
-gt
is “greater than”$1
is the bash reference to the first value that is passed to the script.sh