|
4 days
50% Lecture/50% Lab
Basic Level
Linux Shell programming is useful for automating everyday tasks by executing Linux commands from within a script. Shell programming is especially popular with
system administrators, but can be helpful to programmers, database administrators, CGI programmers, and end users as well.
Upon completion of this course, students will be able to:
- read, write, customize, and debug Shell scripts
- understand the Shell's role and responsibilities; e.g. handling processes, command execution, subshells, pipes, I/0 redirection, wildcards, job control, etc.
- customize Shell initialization files, such as the .cshrc, .profile, .login, etc.
- use the power of regular expressions to extract data from files and pipes with grep, sed and awk (nawk, gawk)
- understand how to use the Shell interactively
- use the Shell as a programming language including constructs such as loops, decision making constructs, switch statements, functions
- test file attributes
- debug scripts
Linux Shell Programming is recommended for people who are familiar with basic Linux and want to learn more sophisticated commands and how to integrate them in Shell scripts in order to automate tasks.
Students need to be familiar with basic Linux commands, such as cd, ls, pwd, cp, mv etc. and be able to navigate the directory tree. They should also be familiar with one of the Linux text editors, such as vi, emacs, or textedit.
Perl Programming and Advanced Perl Programming
This is an intensive, interactive course, which is approximately 50% lecture and 50% lab. Questions are highly encouraged. On the final day, students are given access to a zipped file containing all of the solutions to the labs and the examples used throughout the notebook.
Day One
Module 1 -- Intro to the Shell
- What is Shell?
- The Three Major Shells
- History of the Shell
- System Startup
- The Shell as a Command Interpreter
- Definition of a Shell Script
Lab Exercise 1
Module 2 -- The Linux Tool Box
- What are Regular Expressions?
- Regular Expression Metacharacters and how they work
- Anchors
- The Dot
- Character Sets
- Metasymbols
- Greedy Quantifiers
- Alternation
- Grouping
- Capturing
- Repeating
- The grep Family ( grep, egrep, fgrep)
Lab Exercise 2
Day Two
Lab Exercise 3
- The awk Programming Language
Module 2 --(Awk continued )
Lab Exercise 4
Module 3 - The Interactive Shell
- Startup
- The Environment
- Command line
- Exit status
- Command line history
- Aliases
- Job Control
- Metacharacters
- Filename Substitution
- Variables
- Quoting
- Command Substitution
- Redirection and Pipes
Lab Exercise 5
Day Three
Module 4 -- Programming the Shell
- Construction of a Shell Script
- Execution of a Shell Script
Lab Exericse 6
- Positional Parameters
- Variables
- Reading input
Lab Exercise 7
- Conditional Constructs (if if/else)
- Arithmetic
- File testing
Day Four
Lab Exercise 8
- The Case/Switch Mechanism
- Loops
Lab Exercise 9
Lab Exercise 10
- Debugging
- Handling Signals
- Review (A complete script is provided to review course content)
|