[WEBINAR] The New Normal: Dealing with the Reality of an Unsecure World

Shell Variable

Definition - What does Shell Variable mean?

A shell variable is a variable that is available only to the current shell. In contrast, an environment variable is available system wide and can be used by other applications on the system.

A shell is the operating system's command interpreter. It processes the commands entered on the command line or read from a shell script file.

Techopedia explains Shell Variable

A variable is a location in memory that is used to hold a value. This location is assigned a name to make it descriptive. The value could be any type of data such as a name, number, text or filename/directory. So, a variable is nothing more than a pointer to a particular data. A shell allows a user to create, assign or delete variables. However, these variables are only temporary and are automatically deleted when the shell session is closed. To make a shell variable persistent and available system wide, it must be exported, thus converting it into an environment variable. The command used for doing this depends on the specific shell being used. In the Bash shell used by Linux, the command is "export".

A shell variable is created with the following syntax: "variable_name=variable_value". For example, the command "set COMPUTER_NAME=mercury" creates the shell variable named "COMPUTER_NAME" with a value of "mercury". For values with spaces, quotation marks must be used. Although not required, the convention in Unix is to use uppercase letters for the variable names. Also, in Unix, variable names, like filenames, are case sensitive.

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.