Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Bash Scripting Basics
Rating: 4.3 out of 5(241 ratings)
23,567 students

Bash Scripting Basics

Automate Linux, Unix or Mac
Created byFrank Anemaet
Last updated 8/2021
English
English [Auto],

What you'll learn

  • Learn the basics of bash scripting
  • Create your own scripts
  • Repeat commands using various loops
  • Be able to automate anything Linux

Course content

1 section • 10 lectures • 49m total length
  • Introduction6:05

    Learn to write basic shell scripts for linux and unix, including hello world output, using any text editor, making scripts executable, and reading input into variables with the dollar sign.

  • Variables6:06

    Learn to store data in bash with variables. Use quotes for text and numbers, reference with a dollar sign, follow naming rules, and make scripts executable with chmod +x.

  • Parameters5:27

    Learn how to pass parameters to bash scripts, access them with $0, $1, $2, and $#, make scripts executable, and manage process ids with $$ and kill.

  • If statements5:28

    Explore how bash if statements evaluate conditions on variables to run or skip code blocks. Master equality and not equal checks and greater than and smaller than comparisons.

  • Loops7:51

    Explore bash for loops and while loops to repeat code blocks a set number of times or until conditions are met, with examples from ranges, user input, and simple prints.

  • Arrays5:49

    Replace many individual variables with arrays to store names, access items by zero-based indices in brackets, and loop over the list with a for loop to output each name.

  • Script2:33

    Learn how to run multiple shell commands sequentially with a bash script, execute each line in order, and automate tasks by capturing command outputs into variables.

  • Network script4:29

    Build a simple bash script that outputs network information, clears the screen, prints a header, and runs commands line by line to reveal IPv4 addresses, devices, and current connections.

  • Output redirection2:03

    Learn how to redirect command output to a file in bash using the greater-than symbol. Save outputs to the home directory and verify the file contains the script's output.

  • Functions4:02

    Split large Bash scripts into functions to organize hundreds of commands, define them with curly braces, call by name, and reuse in loops for readability.

Requirements

  • Have Linux, BSD or Mac available

Description

bash is a computer programming language and command language interpreter, usually for the UNIX operating system. The name comes from the Bourne-Again SHell. bash is a dialect of the popular bourne shell, and is one of the most popular shells for interactive use.

Scripts can be run on Linux, Mac OS X and the UNIX variants. At the end of this course, you will be able to create your own scripts.

In this course you learn the basics of bash scripting. You will learn:

  • How to setup a development environment for bash scripting

  • How to write bash scripts

  • How to run bash scripts

  • How to use variables and loops

  • How to use functions

  • much more

If you are a developer you can use this material to get an idea what is possible with bash scripting and maybe you find some useful tips and tricks. If you are a system administrator you may discover in this series of tutorials some tricks for your daily tasks or some missing tools that could help you in your work.

Bash scripts run interpretively. That means that when you run a bash script, it's just executing each command one after the other in the order in which they're written.

This is not about advanced bash techniques, but about getting a good set of basic knowledge on bash scripting. The material here will work with any version of bash and even with other shells.

I've been writing bash scripts for over a decade, and it really improved my productivity. With this course, hopefully you can do the same


Who this course is for:

  • Linux users that want to learn Bash Scripting