Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Create a New Linux Environment Variable
#1


How to Create a New Linux Environment Variable



The basic syntax of this command would look like this:


export VAR="value"

Let’s break it down:


     
  • export – the command used to create the variable
  •  
  • VAR – the name of the variable
  •  
  • = – indicates that the following section is the value
  •  
  • “value” – the actual value

In a real-world scenario, the command could look like this:


export edward="hostinger"

Let’s see how we could change the value of the TZ – timezone – variable:


     
  1. First, let’s view the time:

date

The command will output the current time.


     
  1. Then we can use the export command to alter the timezone:

export TZ=”US/Pacific”

Now that the variable’s value was changed, we can check the time again by using the date command, which would output a different time appropriate to the changes made to the Linux environment variable.




Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)