Personal tools
Contact Us 24/7 > 1 866.SIX FEET
Sections

Skip to content. | Skip to navigation

Home > Blog > Shell Script 101 Tech Talk Notes and Video

Blog

Shell Script 101 Tech Talk Notes and Video

written by Clayton Parker on Wednesday August 7, 2013
Comments | Filed under: ,

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.

 
Add comment

You can add a comment by filling out the form below. Plain text formatting.

puzzle

Next Steps


Select a type of support:

Contact our sales team

First name:
Last name:
Email:
Phone Number:
Message:
Fight spam:
What is + ?
 
Call Us 1 866.SIX FEET
Sections