-
Get a fast-paced introduction to Bash script, a popular shell scripting language.
Bash, or the Bourne Again Shell, is a widely popular command-line interpreter for administration and programming tasks. But Bash is different than most scripting languages. That's why Scott Simpson spends some time in this course running you through the syntaxâintroducing variables, numbers, and control structuresâso you can start writing scripts right away. He shows you how to wrap up multiline operations in one file, implement flow control, and interact with users to get input. Plus, he offers challenges along the way that allow you to put what you've learned to the test.
Overview
Syllabus
-
Introduction
- Learning Bash scripting
- What's Bash?
- Pipes and redirections
- Bash builtins and other commands
- Brackets and braces in Bash
- Bash expansions and substitutions
- Brace expansion
- Parameter expansion
- Command substitution
- Arithmetic expansion
- Choosing a text editor for Bash scripting
- Understanding Bash script syntax
- Displaying text with echo
- Working with variables
- Working with numbers
- Comparing values with test
- Comparing values with extended test
- Formatting and styling text output
- Formatting output with printf
- Working with arrays
- Challenge: Make a script that generates a system report
- Solution: Make a script that generates a system report
- Conditional statements with the if keyword
- Working with while and until loops
- Introducing for loops
- Selecting behavior using case
- Using functions
- Reading and writing text files
- Challenge: Build a script using control structures
- Solution: Build a script using control structures
- Working with arguments
- Working with options
- Getting input during execution
- Ensuring a response
- Challenge: Make a script that uses input
- Solution: Make a script that uses input
- Troubleshooting
- Ensuring script portability
- Next steps