Video
Functions

Shell scripting concepts covered in this lesson:

  • Reasons to create functions

  • DRY vs WET programming concepts:

    • DRY: Don’t Repeat Yourself

    • WET: Write Everything Twice, We Enjoy Typing, Waste Everyone’s Time

  • Defining functions

  • Calling functions

  • Sending messages to the syslog subsystem with the logger command.

  • Where to place functions in your script.

  • Variable scope and the local shell builtin.

  • Passing in data to a function.

  • Making variables read-only with the readonly shell builtin.

  • How to backup files before you change them.

  • Exit status of functions and the return command.


Skills that you will get in this material