Show more `echo` variable examples.

QuestionsQuestions8 SkillsProDec, 10 2025
062

You got it! Labby is happy to show you more echo examples involving variables.

First, let's create a variable. You can think of a variable as a named container that holds a value.

  1. Define a variable:

    NAME="Labby"

    This command creates a variable named NAME and assigns the string "Labby" to it.

  2. Echo the variable: To display the value stored in the NAME variable, you use a dollar sign ($) before the variable name:

    echo "Hello, my name is $NAME."

    You should see:

    Hello, my name is Labby.

    The shell replaces $NAME with its actual value before echo displays the string.

  3. Another variable example:

    CITY="Techville"
    echo "I live in $CITY."

    Output:

    I live in Techville.

Why is this useful?
It helps to make your commands and scripts more dynamic. Instead of typing the same information repeatedly, you can store it in a variable and reuse it.

Go ahead and try these examples in your terminal! Feel free to create your own variables and echo them. Let me know if you have any other questions!

0 Comments

no data
Be the first to share your comment!