Bash Scripting

Rating:
1 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 51 vote, average: 5.00 out of 5
Loading...
Please Log in or register to rate

Bash Scripting

GS-201

Bash is the shell (command language interpreter) for the GNU operating system. Bash is largely compatible with sh and incorporates useful features from the Korn shell ksh and the C shell csh. With Bash you can automate just about any task on a UNIX system. Whether you are a system administrator, a developer or a power user, Bash will make you more productive.

In this course you will learn how to write, debug and maintain complex and elegant scripts to automate tasks and make your life with Linux easier.

Course format: Total length of the course is 16-24 academic hours. (2-3 days) About 50% of the time is hands on lab work.

Audience

Target Audience:
– System administrators who would like to save time by automating tasks
– DevOps engineers who need to automate processes
– Anyone who needs to make their life on UNIX

Prerequisites:
In order to take this course you must have working knowledge of the UNIX shell, and be able to use at least one Unix/Linux editor (preferably Vim or Emacs)

Course Topics

Module 1 – Bash and Bash scripts
– Shell types
– Advantages of Bash
– Executing commands
– Shell building blocks (syntax, shell commands, shell functions)

Module 2 – Writing and debugging scripts
– Hello world
– Creating script
– Executing script
– Sh-bang
– Comments
– Debugging

Module 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

Module 4 – Wildcards are not Regexes
– Wildcards
– Character Classes

Module 5 – Regular Expressions
– grep, egrep
– Character classes

Module 6 – sed (Stream EDitor)
– Printing lines containing a pattern
– Deleting lines of input containing a pattern
– Ranges of lines
– Find and replace with sed

Module 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

Module 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

Module 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

Module 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

Module 11 – Types of Variables
– Scalars
– Arrays
– Constants (readonly variables)
– Operations on variables
– Variable assignment
– Variable substitution

Module 12 – Functions
– Function syntax
– Positional parameters in functions
– Listing functions

Module 13 – Catching signals
– What are Signals
– How to send signals
– Trapping signals

Module 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

© Copyright - Skilit - Site by Dweb