<< All Blog Posts

Shell Script 101 Tech Talk Notes and Video

Shell Scripts are a great way to tackle a repetitive task. They are a convenient means for automating many different things. From mounting and dismounting volumes to manipulating and combining files. Shell scripts help make life easier.

In the video tutorial below, I walk through setting up a basic shell script, and discuss many of the steps necessary to create a very efficient and productive script.

If you would like to discuss Six Feet Up building your next web application, contact us or signup for our newsletter to get more articles like this.

Here are some key points from the video:

General Info

The use of Shell Scripts is ideal for tasks such as program execution, printing text, and file manipulation. Instead of typing the same thing into the command line over and over, shell scripts compile a series of shortcuts to help get the job at hand done.

Variables and their uses
There are four different ways to set a variable
Quotes
Single and double quotes do not act the same
Conditionals
Your basic if statements
Conditional Expressions
Use built-in checks for existence of files, directories, executables, etc.
Chaining
&& for AND, || for OR. Chain these together to simplify your scripts
Loops
How to iterate over a list of items
Redirection
Redirecting 0, 1, and 2 in meaningful ways
Output to File
Using a single greater than symbol redirects standard out to a file, double to append
Change Streams
Can write standard error to standard out
Pipes
Send standard out from one program to the next
Exit Codes
Anything from 1-255 is an error
Shebang
Tells what is going to execute the body of the file

Additional resources.


Thanks for filling out the form! A Six Feet Up representative will be in contact with you soon.

Connect with us