Overview
This course deals comprehensively with the capabilities of BASH and the utilities commonly used in the development of scripts. The training concentrates on a common approach to BASH on variants of UNIX, and currently covers versions of BASH up to 4.1.
Target Audience:
The course is aimed at programmers and analysts operating in Unix environments using BASH, as well as Unix system and network managers. This course is particularly suitable for those companies, which take a multi-vendor open systems view, and is applicable to all flavours of UNIX including Linux, HP-UX, Solaris, AIX, and so on.
Prerequisites
- Delegates should have a good working knowledge of Linux or UNIX systems, which includes a working knowledge of UNIX commands and utilities. This can be gained by attending our UNIX Fundamentals or Linux Essentials courses
- Delegates should also have a practical understanding of programming concepts such as variables, and decision-making constructs.
Delegates will learn how to
At the end of this course you will be able to:
- Use all significant features of the BASH language
- Implement advanced variable and array manipulation
- Develop shell scripts that contain advanced decision making constructs
- Use the tracing features to speed the development of shell scripts
- Implement advanced data stream handling by using process substitution
- Incorporate functions in script design
- Integrate BASH scripts with those written using other shells
- Write reliable, maintainable and efficient shell scripts
Outline
Chapter 1: Introduction and Revision
- Command-line structure
- Shell interpretation
- Filename expansion
- Variable and command expansions
- Quoting
- Redirection
- Here documents
- Pipes
Chapter 2: Using BASH
- The Bash story (in brief)
- Bash personalities
- Shell options
- Bash shell options
- Start-up files
- Some shell variables
- Aliases and functions
- Command-line recall and editing
- Navigation for the impatient
- echo and help
Chapter 3: Shell Scripts
- Command types
- Creating shell scripts
- Creating processes
- The exec command
- Exit status
- Using # in shell scripts
- Running shell scripts
- BASH_ENV
- Command groups and sub-shells
Chapter 4: Handling Variables
- Legal variable names
- Creating variables
- The read command
- Exporting variables
- Special characters
- Checking the environment
- eval
Chapter 5: Parameters and Friends
- Positional parameters
- Access to positional parameters
- $*, $@, and $#
- Changing positional aparmeters
- $* versus $@
- Other special variables
Chapter 6: Behaviour Therapy
- Sending signals,
- Receiving signals and the trap command
- Shell tracing methods
- Tracing shell expansions
- DEBUG and ERR traps
- Dry run of a script
- The script command
- Error messages are your friends
Chapter 7: Flow Control
- Testing commands
- 'if' statements
- 'while' and 'until' loops
- Bourne shell test command
- Korn shell test command
- Bourne and Korn syntax compared
- Numeric tests
Chapter 8: Variable Expansion
- Extracting a sub-string
- Deleting a sub-string
- Editing sub-strings
- Test and set/exit expansions
- The colon command
Chapter 9: Lofty Variables
- Variable attributes
- Compound assignments
- Arithmetic conditionals
- Working with floating-point
Chapter 10: More Loops
- List processing - 'for' loop
- Processing positional parameters
- 'break' and 'continue'
- Infinite loops
- The 'select' loop
- Reading in a loop from a file
- Reading in a loop from a program (process substitution)
Chapter 11: Sophisticated Tests
- Statement short-cuts
- I/O redirection with if-then-fi
- The 'case' statement
- case flow control - Bash 4
- Shell pattern matching
- Extended pattern operators
- Locales and character classes
Chapter 12: Using Functions
- Functions vs. scripts
- Creating functions
- Listing and removing functions
- Function parameters and return values
- Local and global variables
- Where to store functions
- Exported functions
- Using external function libraries
Chapter 13: Professional Scripts
- Parsing script options with getopts
- Handling errors
- Formatting output - printf
- Tips for shell programmers: programming for change
- Tips for shell programmers: programming for performance
Chapter 14: Handling Arrays
- Arrays: the concepts
- Bash array syntax
- Array syntax gotchas
- Initialising arrays
- Appending to an array
- Finding array limits
- Using read with an array
- Using mapfile/readarray
- Associative arrays
Chapter 15: Advanced IO
- The concepts
- Using file descriptors
- Block redirection
- Named pipes (FIFOs)
- Process substitution
Chapter 16: Basic sed
- Running sed
- Basic regular expressions
- sed line addressing
Chapter 17: Basic awk
- The awk programming model
- awk variables
- awk opeators
- Comparing awk with shell constructs
Certification:
This course will assist delegates preparing for the following exams:
- LPI General Linux I - L101
Frequently asked questions
How can I create an account on myQA.com?
There are a number of ways to create an account. If you are a self-funder, simply select the "Create account" option on the login page.
If you have been booked onto a course by your company, you will receive a confirmation email. From this email, select "Sign into myQA" and you will be taken to the "Create account" page. Complete all of the details and select "Create account".
If you have the booking number you can also go here and select the "I have a booking number" option. Enter the booking reference and your surname. If the details match, you will be taken to the "Create account" page from where you can enter your details and confirm your account.
Find more answers to frequently asked questions in our FAQs: Bookings & Cancellations page.
How do QA’s virtual classroom courses work?
Our virtual classroom courses allow you to access award-winning classroom training, without leaving your home or office. Our learning professionals are specially trained on how to interact with remote attendees and our remote labs ensure all participants can take part in hands-on exercises wherever they are.
We use the WebEx video conferencing platform by Cisco. Before you book, check that you meet the WebEx system requirements and run a test meeting (more details in the link below) to ensure the software is compatible with your firewall settings. If it doesn’t work, try adjusting your settings or contact your IT department about permitting the website.
How do QA’s online courses work?
QA online courses, also commonly known as distance learning courses or elearning courses, take the form of interactive software designed for individual learning, but you will also have access to full support from our subject-matter experts for the duration of your course. When you book a QA online learning course you will receive immediate access to it through our e-learning platform and you can start to learn straight away, from any compatible device. Access to the online learning platform is valid for one year from the booking date.
All courses are built around case studies and presented in an engaging format, which includes storytelling elements, video, audio and humour. Every case study is supported by sample documents and a collection of Knowledge Nuggets that provide more in-depth detail on the wider processes.
When will I receive my joining instructions?
Joining instructions for QA courses are sent two weeks prior to the course start date, or immediately if the booking is confirmed within this timeframe. For course bookings made via QA but delivered by a third-party supplier, joining instructions are sent to attendees prior to the training course, but timescales vary depending on each supplier’s terms. Read more FAQs.
When will I receive my certificate?
Certificates of Achievement are issued at the end the course, either as a hard copy or via email. Read more here.