Bash Scripting

Target Audience

Prerequisites

Objectives

Course Format

Syllabus

  1. Bash and Bash scripts
    • Shell types
    • Advantages of Bash
    • Executing commands
    • Shell building blocks (syntax, shell commands, shell functions)
  2. Writing and debugging scripts
    • Hello world
    • Creating script
    • Executing script
    • Sh-bang
    • Comments
    • Debugging
  3. The Bash environment
    • Shell initialization files
    • Configuration files
    • Variables (Global and Local)
    • Creating variables
    • Using variables
    • Exporting variables
    • Strings and Quoting characters
    • Shell expansion
    • Aliases
    • Displaying and changing Options
    • Pipelines
  4. Wildcards are not Regexes
    • Wildcards
    • Character Classes
  5. Regular Expressions
    • grep, egrep
    • Character classes
  6. sed (Stream EDitor)
    • Printing lines containing a pattern
    • Deleting lines of input containing a pattern
    • Ranges of lines
    • Find and replace with sed
  7. awk (Gawk The GNU awk programming language)
    • Getting Started with awk commands
    • Printing selected fields
    • The input field separator
    • The output field separator
    • The BEGIN and END blocks
    • User defined variables
  8. Control Flow and Conditional statements
    • if, then, else, fi
    • Checking command line arguments
    • Testing the number of arguments
    • Testing that a file exists
    • Comparison Operators
    • Boolean operations
    • Nested if/then Condition Tests
    • exit status codes
    • case
  9. Writing interactive scripts I/O
    • Displaying user messages using echo
    • Catching user input using the read built-in command
    • Prompting for user input
    • Redirection and file descriptors
    • File input and output
    • Here documents
  10. Loops for Repetitive tasks
    • The for loop
    • The while loop
    • The until loop
    • Break and continue
    • Making menus with the select built-in
    • The shift built-in
  11. Types of Variables
    • Scalars
    • Arrays
    • Constants (readonly variables)
    • Operations on variables
    • Variable assignment
    • Variable substitution
  12. Functions
    • Function syntax
    • Positional parameters in functions
    • Listing functions
  13. Catching signals
    • What are Signals
    • How to send signals
    • Trapping signals
  14. Useful shell commands
    • awk
    • cat
    • cd
    • chgrp
    • chmod
    • chown
    • cp
    • cut
    • echo
    • egrep
    • exit
    • getops
    • grep
    • head
    • ls
    • mv
    • pwd
    • sed
    • sort
    • tail
    • touch
    • uniq
    • wc

Contact

Contact: Gabor Szabo gabor@hostlocal.com
Phone: +972-54-4624648