How to create an environment variable?

To create an environment variable in a Linux shell, you can follow these steps:

  1. Open your terminal.

  2. Use the export command to create a new environment variable. For example, to create a variable named MY_VARIABLE with the value "Hello from my variable", you would run:

    export MY_VARIABLE="Hello from my variable"
  3. To verify that the variable has been created, you can use the echo command:

    echo $MY_VARIABLE
  4. If you want to make the variable available in child processes, you can simply use it as shown above. If you want to remove the variable later, you can use the unset command:

    unset MY_VARIABLE

This will create and manage your environment variable in the current shell session.

0 Comments

no data
Be the first to share your comment!