Udemy
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
Development
Web Development Data Science Mobile Development Programming Languages Game Development Database Design & Development Software Testing Software Engineering Development Tools No-Code Development
Business
Entrepreneurship Communications Management Sales Business Strategy Operations Project Management Business Law Business Analytics & Intelligence Human Resources Industry E-Commerce Media Real Estate Other Business
Finance & Accounting
Accounting & Bookkeeping Compliance Cryptocurrency & Blockchain Economics Finance Finance Cert & Exam Prep Financial Modeling & Analysis Investing & Trading Money Management Tools Taxes Other Finance & Accounting
IT & Software
IT Certification Network & Security Hardware Operating Systems Other IT & Software
Office Productivity
Microsoft Apple Google SAP Oracle Other Office Productivity
Personal Development
Personal Transformation Personal Productivity Leadership Career Development Parenting & Relationships Happiness Esoteric Practices Religion & Spirituality Personal Brand Building Creativity Influence Self Esteem & Confidence Stress Management Memory & Study Skills Motivation Other Personal Development
Design
Web Design Graphic Design & Illustration Design Tools User Experience Design Game Design Design Thinking 3D & Animation Fashion Design Architectural Design Interior Design Other Design
Marketing
Digital Marketing Search Engine Optimization Social Media Marketing Branding Marketing Fundamentals Marketing Analytics & Automation Public Relations Advertising Video & Mobile Marketing Content Marketing Growth Hacking Affiliate Marketing Product Marketing Other Marketing
Lifestyle
Arts & Crafts Beauty & Makeup Esoteric Practices Food & Beverage Gaming Home Improvement Pet Care & Training Travel Other Lifestyle
Photography & Video
Digital Photography Photography Portrait Photography Photography Tools Commercial Photography Video Design Other Photography & Video
Health & Fitness
Fitness General Health Sports Nutrition Yoga Mental Health Dieting Self Defense Safety & First Aid Dance Meditation Other Health & Fitness
Music
Instruments Music Production Music Fundamentals Vocal Music Techniques Music Software Other Music
Teaching & Academics
Engineering Humanities Math Science Online Education Social Science Language Teacher Training Test Prep Other Teaching & Academics
AWS Certification Microsoft Certification AWS Certified Solutions Architect - Associate AWS Certified Cloud Practitioner CompTIA A+ Cisco CCNA Amazon AWS CompTIA Security+ AWS Certified Developer - Associate
Photoshop Graphic Design Adobe Illustrator Drawing Digital Painting InDesign Character Design Canva Figure Drawing
Life Coach Training Neuro-Linguistic Programming Mindfulness Personal Development Meditation Personal Transformation Life Purpose Neuroscience Emotional Intelligence
Web Development JavaScript React CSS Angular PHP WordPress Node.Js Python
Google Flutter Android Development iOS Development Swift React Native Dart Programming Language Mobile Development Kotlin SwiftUI
Digital Marketing Google Ads (Adwords) Social Media Marketing Google Ads (AdWords) Certification Marketing Strategy Internet Marketing YouTube Marketing Email Marketing Retargeting
SQL Microsoft Power BI Tableau Business Analysis Business Intelligence MySQL Data Analysis Data Modeling Data Science
Business Fundamentals Entrepreneurship Fundamentals Business Strategy Online Business Business Plan Startup Freelancing Blogging Home Business
Unity Game Development Fundamentals Unreal Engine C# 3D Game Development C++ 2D Game Development Unreal Engine Blueprints Blender
2021-01-07 09:02:50
30-Day Money-Back Guarantee
IT & Software Other IT & Software Linux

Shell scripting for humans

Learn-as-you-code writing bash shell scripts
New
Rating: 5.0 out of 55.0 (1 rating)
3 students
Created by Jacob Salmela
Last updated 1/2021
English
English
30-Day Money-Back Guarantee

What you'll learn

  • How to write shell scripts in bash
  • How to use the command line
  • How to use vim to create files
  • How to parse and manipulate strings and text files
  • How to use variables
  • How to use conditionals to take action if something is true or false
  • How to write loops to repeat a process
  • How to understand logic and programming
  • How to write a command line utility that accepts arguments and options

Requirements

  • A Mac (preferably) or other computer that can run a bash shell

Description

This entire course is aimed at beginners, but if you're familiar with Linux or even other operating systems, you'll still get something out of the later sections in the course.  At the end of the course, you'll have your own template script you can use to start creating your own.

You won't find any slides on this course; it's all hands-on work that lets you learn as you code.  After the introduction, you'll start writing a script right away and I'll explain each line of code, what it does, and why you want it. 

Throughout the course, you will write 20 different scripts:

  • first_script will print text to the screen (created with echo)

  • second_script will print text to the screen (created with `vim`) and uses a shebang

  • debug will run verbosely with extra output

  • debug2 will run verbosely with extra output (`vim` and `chmod` practice)

  • cd will move into a folder and list it's contents (a pseudo file browser script)

  • vars will assign and prints a variable

  • literal will assign and print a literal variable name

  • cmd_output_vars will save the output of a command in a variable and print it to the screen

  • if will do simple conditional checks

  • rename a broken script that will batch rename files using `if`/`else`/`mv` and more, bu quires you to fix it (debugging practice)

  • lowercase will use a for loop to loop through files in a directory

  • change_extension will change all files of a certain file extension to a new file extension

  • dir_args will accept a directory as an argument passed to it and list only folders it contains

  • version will print a version when the `--version` flag is passed (also practicing global and cal variable scopes)

  • usage will print a help message with `--help` or if no args are passed

  • logging will log to a file in three ways (INFO, WARN, DEBUG) using a log with the same name as the script

  • trap will show a message when you interrupt the script's execution

  • parse_args will parse for different arguments

  • detect_os will check several operating systems and display the one it detects

  • template will be a starting point you can use for all your future shell scripts

The start of the course is intentionally slow and broken into many small lectures.  This allows you to really understand what's going on and let you absorb what you've learned and then apply it to a real-world example.  In addition to learning shell scripting, you'll also learn about macOS and Linux in general as this helps you write better scripts. 

I recommend using a Mac for this course because it has everything you need to get started without having to install anything extra.  I'll also be working on a Mac throughout the course.  But you'll be able to run all the same scripts from a Linux machine, or even a Windows machine that runs the Windows Subsystem for Linux.  There will be some differences in those cases, but I'll explain them as we go.

If you're learning this for work, the first sections can get you up to speed quickly, while the later sections can help you uncover advanced topics you may need for your job. 

If you're joining the course for your personal life, you can automate some tedious tasks you may do such as renaming files, data entry, finding things, etc.

Who this course is for:

  • People interested in Linux or programming but don't know where to start
  • People curious about programming that need an easy place to start
  • People who have tried to learn programming but gave up
  • People curious about Linux
  • People curious about automation
  • System admins or engineers
  • Entry level programmers

Course content

18 sections • 98 lectures • 3h 8m total length

  • Preview01:18
  • Preview03:06
  • Command prompt anxiety and your first script
    02:05
  • How shell scripts run
    01:19
  • Some of the world's best software is built on shell scripts
    01:31
  • Linux vs. macOS
    02:08

  • Create a new script with vim
    01:59
  • Writing text in vim
    01:15
  • Writing in vim
    1 question
  • Preview01:46
  • Adding a comment to your script
    01:40
  • Printing text to the screen (echo and printf)
    01:07
  • Printing text
    1 question
  • Saving your file in vim and returning to the command prompt
    01:26
  • Why use vim (or other command line text editors)?
    01:58

  • Finding your script (ls)
    01:28
  • Viewing file permissions
    01:40
  • Making your script executable (chmod)
    02:37
  • Introduction to Linux file permissions
    02:10
  • File permissions
    1 question
  • Running your script
    02:30
  • Debugging your script (set -x)
    02:56
  • Debugging your scripts
    2 questions
  • Commands you've learned including: vim, echo, printf, ls, chmod.
    01:12

  • Running commands directly on the command line
    01:40
  • Six commands for navigating the filesystem
    00:55
  • The ls command
    01:13
  • The cd command
    00:59
  • The mv command
    01:21
  • The rm command
    01:26
  • The cp command
    00:31
  • The cat command
    01:32
  • Writing and running your file browser script
    02:12
  • Explore available commands
    3 questions

  • -h and --help and man
    02:42
  • Preview00:57
  • Commands to explore
    00:42
  • Exploring on your own
    2 questions

  • What is a variable?
    02:41
  • How to create your own variables
    02:42
  • How to view variables (parameter expansion)
    01:39
  • Creating and viewing variables (parameters)
    2 questions
  • Literal variables (escaping)
    02:02
  • Command output as a variable
    04:50

  • If statements
    00:28
  • Writing your first if statement
    02:42
  • Operators
    01:19
  • greater-than, less-then (-gt, -lt, -ge, -le)
    01:43
  • Non-zero, zero, is a file, is a directory, etc.
    02:06
  • Variables and conditionals
    00:50
  • If/else statements
    01:32
  • Writing a (broken) file renaming script (that you can fix by learning more)
    03:47

  • What is a loop?
    01:26
  • Don't repeat yourself
    01:16
  • Types of loops
    00:58
  • The for loop
    02:02
  • Preview02:34

  • What does the pipe character do?
    02:33
  • STDIN and STDOUT
    01:17
  • Commands that work well with pipes
    00:56
  • Using a pipe in your script
    02:50
  • Preview01:49
  • Using a pipe with awk to print only certain columns of information
    01:42
  • Using a pipe with cut to change a file's extension
    04:18
  • Stringing pipes together
    00:58

  • vim 42
    00:47
  • Back to Insert Mode from Command Mode
    1 question
  • Installing homebrew (optional, but useful going forward)
    00:41
  • fortune
    00:22
  • cowsay
    00:35
  • Review of the pipe
    1 question
  • sl (optional)
    00:23
  • Star Wars telnet video
    00:28
  • Command structure
    1 question
  • Lord of the Rings timeline
    00:16
  • Searching text
    1 question

Instructor

Jacob Salmela
Software Engineer V and open source contributor
Jacob Salmela
  • 5.0 Instructor Rating
  • 1 Review
  • 3 Students
  • 1 Course

I have a bachelor's degree in information technology.  I have been writing bash scripts for ten years, and created several different open source command line utilities and projects, which you can find on GItHub.

I currently work in the high performance computing industry working exclusively with Linunx on a daily basis.

I remember when I first started working in Linux and feeling completely lost.  I kept thinking it was easy to just click and point to do stuff.  Writing cryptic commands on an old-looking terminal prompt seemed so bizarre.  As I used it, I began to see the potential and how you could accomplish more on the command line than in a graphical interface. 

The world of Linux, macOS, and the command line is filled with fun, nerdy things, which I'll show you along the way.

I'm not on social media but I do have GitHub and my personal blog, which is filled with all sorts of fun things I've done with scripting.



  • Udemy for Business
  • Teach on Udemy
  • Get the app
  • About us
  • Contact us
  • Careers
  • Blog
  • Help and Support
  • Affiliate
  • Terms
  • Privacy policy
  • Cookie settings
  • Sitemap
  • Featured courses
Udemy
© 2021 Udemy, Inc.