0
0
Linux CLIscripting~15 mins

export command in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Using the export Command in Linux Shell
📖 Scenario: You are working in a Linux terminal and want to set environment variables that other programs and scripts can use.
🎯 Goal: Learn how to create a variable and use the export command to make it available to child processes.
📋 What You'll Learn
Create a shell variable with a specific name and value
Use the export command to set the variable as an environment variable
Verify the variable is available in a child shell
💡 Why This Matters
🌍 Real World
Setting environment variables is common when configuring software or scripts to use specific settings.
💼 Career
Knowing how to use <code>export</code> is essential for system administrators, developers, and anyone working with Linux shells.
Progress0 / 4 steps
1
Create a shell variable
Create a shell variable called MY_VAR and set its value to HelloWorld.
Linux CLI
Need a hint?

Use the syntax VARIABLE_NAME=value without spaces.

2
Export the variable
Use the export command to make the variable MY_VAR available to child processes.
Linux CLI
Need a hint?

Use export VARIABLE_NAME to export the variable.

3
Check the variable in a child shell
Run a child shell and use the echo command to display the value of MY_VAR inside it.
Linux CLI
Need a hint?

Use bash -c 'echo $MY_VAR' to run a command in a child shell.

4
Display the exported variable
Print the value of MY_VAR in the current shell using the echo command.
Linux CLI
Need a hint?

Use echo $MY_VAR to print the variable.