Chapter 6. Neat Tricks with Shell Scripting

In the last chapter, you learned about shell and environment variables. You also learned about how to export environment variables, read-only variables, command-line arguments, and create/handle arrays.

In this chapter, we will cover following topics:

  • Interactive Shell scripts and reading from the keyboard
  • Using the here operator (<<) and here string (<<<)
  • File handling
  • Enabling debugging
  • Syntax checking
  • Shell tracing

Interactive Shell scripts – reading user input

The read command is a shell built-in command for reading data from a file or keyboard.

The read command receives the input from the keyboard or a file until it receives a newline character. Then, it converts the newline character into a null character: ...

Get Learning Linux Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.