0
0
Linux CLIscripting~15 mins

Environment variables in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Working with Environment Variables in Linux CLI
📖 Scenario: You are setting up a simple script environment on a Linux system. You need to create and use environment variables to store and display user information.
🎯 Goal: Learn how to create, configure, and display environment variables using Linux command line.
📋 What You'll Learn
Create an environment variable with a specific name and value
Create a secondary variable to hold a modified value
Use the main environment variable in a command
Display the value of the environment variable
💡 Why This Matters
🌍 Real World
Environment variables are used to store configuration settings and user information that scripts and programs can access easily.
💼 Career
Knowing how to manage environment variables is essential for system administrators, developers, and anyone working with Linux servers or automation scripts.
Progress0 / 4 steps
1
Create an environment variable
Create an environment variable called USER_NAME and set its value to alice using the export command.
Linux CLI
Need a hint?

Use export VARIABLE_NAME=value to create environment variables.

2
Create a secondary environment variable
Create another environment variable called GREETING and set its value to Hello, $USER_NAME! using the export command.
Linux CLI
Need a hint?

Use double quotes to include variables inside strings.

3
Use the environment variable in a command
Use the echo command to display the value of the GREETING environment variable.
Linux CLI
Need a hint?

Use echo $VARIABLE_NAME to display the value of an environment variable.

4
Display the output
Run the script and ensure the output is exactly Hello, alice!.
Linux CLI
Need a hint?

Make sure you run the commands in a shell that supports environment variables.