Bash: in 5 Minutes or Less
Housekeeping Items 🏡
In this quick tutorial, we’ll be using the bash
shell, but hey — use what you want. My personal favourite is zsh
, which can be downloaded using homebrew
— more on that tool another time. A shell is basically an interpreter for direct requests to the OS, using a command line rather than a graphical user interface. A “terminal” is a way to access this shell. We’ll be using “<>” to denote when something is a filler. For example, if you see <file name>.txt
, that means any text file you’ll use in the example. For most commands there are many options and flags which we won’t cover. Oh, and we’ll use $
as a cursor at the start of commands — you don’t actually type this!
Getting Comfortable 🚶
When diving into new technology, it is a rite of passage to print the famous Hello, world statement. Once you have your terminal open, try the following command: echo Hello, World!
. Just like other environments, the shell can handle variables as well. Try setting a variable, and using echo
in order to print it. Reference the variable by prepending a $
to the < variable name>
.
$ greeting="Hello, World!"
$ echo $greeting