Skip to Content
Learning Linux Shell Scripting
book

Learning Linux Shell Scripting

by Ganesh Sanjiv Naik
December 2015
Beginner content levelBeginner
306 pages
5h 2m
English
Packt Publishing
Content preview from Learning Linux Shell Scripting

Chapter 5. Exploring Expressions and Variables

In the last chapter, you learned about how shell interprets any command, which is entered in the terminal or the command line. We also studied command substitution and separators in detail.

In this chapter, we will cover following topics:

  • Working with environment variables
  • Exporting variables
  • Working with read-only variables
  • Working with command line arguments (special variables, set and shift, and getopt)
  • Working with arrays

Understanding variables

Let's learn about creating variables in shell.

Declaring variables in Linux is very easy. We just need to use the variable name and initialize it with the required content.

$ person="Ganesh Naik"

To get the content of the variable we need to prefix $ before the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Linux Shell Scripting - Second Edition

Learning Linux Shell Scripting - Second Edition

Ganesh Sanjiv Naik

Publisher Resources

ISBN: 9781785286216