Shell Scripting in LINUX/UNIX

COURSE CONTENTS AT A GLANCE
1. History of Linux/Unix
2. Introduction to Linux/Unix
3. Shell

a) What is shell?
b) What is your default shell?
c) What is kernel?
d) How to use shell?
e) What is shell script?
f) Why to write shell script?
g) Advantage of shell scripting
h) Disadvantage of shell scripting
i) Well-known shells with their extensions
j) A basic script-writing format
k) Use of "sha-bang"
l) Script naming
m) Script permissions
n) How to run script?


4. Layers of Unix and their components
a) The layers of Unix
b) Executable
c) Process
d) Daemon
e) User shell
f) "Built-in"/Internal command
g) External command
h) Alias
i) Variable
j) Flag

5. Details about process
a) What is process?
b) Why process required?
c) Why command related with process?
d) Comments and whitespaces
e) Parent process
f) Child process
g) Use of ps, top, pstree, kill etc.
h) Foreground versus background process

6. Shell defaults
a) /etc/profile
b) $HOME/.bash_profile
c) $HOME/.bashrc
d) /etc/bashrc
e) $HOME/.bash_logout
f) Difference between .bash_profile and .bashrc

7. Variables in shell
a) Variable and its classification
b) Variable naming
c) Variable scope
d) Local variable
e) Shell built-in variables
f) Environmental variables
g) User defined variables
h) Exporting shell variables

8. Shell job control
a) What is job?
b) Identifying job
c) Suspend foreground task
d) Lists of background or suspended jobs
e) Resume suspended task in the foreground
f) Resume suspended task in the background

9. Standard I/O - File Descriptors
a) Standard In
b) Standard Out
c) Standard Error

10. Simple filters and grep family of commands
a) The wild cards
b) The pattern matching
c) The metacharacters
d) Regular expressions
  • Specifying class of character
  • Anchoring
  • Using grep, egrep & fgrep
  • cat, less, more, head, tail, cut
  • Use of * , ? , ^ and $

  • 11. Some useful tricks
    a) Escape character
    b) Single quotes
    c) Double quotes
    d) Back quotes




    12. Scripts, which will be run interactively
    a) Prompting for user input
    b) Use of read command
    c) Use of arguments

    13. Higher level language - GAWK
    a) The "gawk" command
    b) Pattern search and special characters
    c) Variable, constant and functions
    d) Field variables and field delimiters
    e) "gawk" special variables
    f) User-defined variables
    g) Constants
    h) Functions
    i) Pattern segment as a condition
    j) Equality and relational operators
    k) Logical operators
    l) Pattern search operators
    m) BEGIN and END special patterns
    n) Range patterns
    o) Arithmetic and assignment operators
    p) Arrays and associative arrays
    q) "gawk" instruction files
    r) Control structures
    • The while loop
    • The for loop
    • The for-in loop
    • The if control structure
    • The next and exit statements

    14. "sed" - The stream editor
    a) Line addressing
    b) Context addressing
    c) Inserting and changing text (i, a and c)
    d) Deleting lines (d)
    e) Writing to files (w)
    f) Interval regular expression (IRE)
    g) Tagged regular expression (TRE)
    h) The remember pattern
    i) The substitution pattern

    15. Decisions & Loops
    a) if statement
    b) if, elseif and else-fi
    c) nested if-else-fi
    d) Mathematical comparators
    e) String comparators
    f) Comparing strings
    g) Checking variables
    h) File comparators
    i) Checking files
    j) Complex comparison
    k) Checking multiple files
    l) Case statement
    m) The while loop
    n) The until loop
    o) The for loop
    p) Breaking out of the current loop


    16. Performing math in the shell
    a) Numerical tools
    b) bc and dc
    c) let
    d) others

    17. PROJECT
    a) Assigning the following through scripting
  • IP address
  • Netmask
  • Gateway
  • Nameserver
  • Hostname

  • b) Configuring the following
  • Configuring DNS SERVER through scripting
  • Configuring MAIL SERVER through scripting
  • Configuring WEB SERVER through scripting
  • Configuring PROXY SERVER through scripting
  • c) Server migration through scripting
    d) Server backup through scripting

    OTHERS
    Regular class test
    Assignment submission (Minimum 10)
  • Download this page