Skip to Content
Linux Command Line and Shell Scripting Bible, 4th Edition
book

Linux Command Line and Shell Scripting Bible, 4th Edition

by Richard Blum, Christine Bresnahan
January 2021
Intermediate to advanced content levelIntermediate to advanced
832 pages
18h 3m
English
Wiley
Content preview from Linux Command Line and Shell Scripting Bible, 4th Edition

CHAPTER 6Using Linux Environment Variables

Linux environment variables help define your Linux shell experience. Many programs and scripts use environment variables to obtain system information and store temporary data as well as configuration information. Environment variables are set in lots of places on the Linux system, and it's helpful to know their locations.

This chapter walks you through the world of Linux environment variables, showing where they are, how to use them, and even how to create your own. The chapter concludes with how to use variable arrays.

Exploring Environment Variables

The Bash shell uses a feature called environment variables to store information about the shell session and the working environment (thus the name environment variables). This feature also allows you to store data in memory that can be easily accessed by any program or script running from the shell. It is a handy way to store needed persistent data.

There are two environment variable types in the Bash shell:

  • Global variables
  • Local variables

This section describes each type of environment variable and shows how to view and use them.

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

Linux Command Line and Shell Scripting Bible, 3rd Edition

Linux Command Line and Shell Scripting Bible, 3rd Edition

Christine Bresnahan, Richard Blum

Publisher Resources

ISBN: 9781119700913Purchase Link