Home About Courses Schedule Services Webinars Contact Search

Linux Shell Programming

SEE SCHEDULE

Duration: 3.0 days

Method: Instructor led, Hands-on workshops

Price: $1920

Course Code: LI1002


Audience

Programmers, application developers, computer analysts, and other Linux users who need to read, maintain, or create shell programs.

Description

This 3-day course provides a thorough introduction to Linux shell programming with focus on Bourne, Korn, and BASH shells. The presentation is an integrated mixture of lecture and workshop activities that introduce and reinforce the basic techniques and approaches to working with Linux commands, the shell, and shell programs. Workshop activities follow the classroom material and are designed for both topic reinforcement and practice. All topics are supported by workshops. This should be taken after the LI1001 3-day Introduction to Linux course.

Objectives

Upon successful completion of this course, the student will be able to:

  • Read, modify, and create shell programs to perform data processing and system tasks
  • Create shell programs that use nested commands; variables, parameters entered on the command line; control structures including if, while loops, until loops, for loops, and case structures; read input from files, other commands, and interactive user input; write to files and other commands, and implement modular design by the use of subprograms.

Prerequisites

Familiarity with Linux and ability to create and edit a text file with the editor vi or other Linux editor.

Topics

  • I. Review of Fundamentals
    • Commands echo, date, who, banner, cal, man, ls -aFpldR, pwd, cd, mkdir, rmdir, rm -r, cp, mv, rm, cat, more, grep with Regular Expressions, wc, sort, cut, chmod, umask
    • Command syntax
    • File system structure
    • Redirection
    • Pipelines
    • Filename generation wildcards
    • Quoting with backslash, single quotes and double quotes
    • Semicolon
    • File and directory permissions
    • Foreground and background processes
    • vi
    • Command history
  • II. Shell Environment
    • .profile and the ENV file
    • Evaluation Order
    • Permissions Required to Execute a Shell Program
    • Comments and blank lines
    • Debugging with the -x trace
    • Built-in shell variables
    • Commands set, env
    • Dangers of the PATH variable
    • Execution of Assignments And Special Shell Commands
    • Execution of Binary Commands
    • Execution of Shell Programs and Command Groupings ( )
    • Execution of shell programs with the . command
  • III. Positional Parameters
    • $1 through $9
    • ${10} through ${511}
    • $#
    • $0
    • $*
    • $#
    • $$
    • shift
  • IV. User-defined variables
    • Variable assignment
    • Variable substitution
    • Curly braces to delimit a variable name
    • Quoting with variable assignment and substitution
    • Commands export, unset, readonly
    • Interactive user input with the read command
    • Modular design with subprograms in the foreground or background
  • V. Nested commands ("command substitution")
    • Bourne shell and Korn shell syntax
    • Double and triple nesting syntax
    • Command expr
  • VI. if Control Structure
    • if structure
    • exit command to terminate execution and set the exit code
    • $?
    • test command
    • Comparison operators
      • Strings
      • Numbers
      • Files and directories
      • And and Or
      • !
      • [ ]
    • Common styles of program organization with if
  • VII. Looping Control Structures
    • while
    • until
    • for
    • Commands break, continue, true, false
    • Common styles of program organization with loops
  • VIII. case Control Structure
    • Case structure
    • Wildcards specific to the case
    • Techniques for data validation
  • IX. let Command and the [[ ]] syntax