What does the 'echo' command do?

0114

The echo command in Bash is used to display a line of text or a variable value to the standard output (usually the terminal). It can also be used to create output in scripts or command-line operations.

Here are some common usages:

  1. Basic Usage:

    echo "Hello, World!"
  2. Displaying Variables:

    name="Labby"
    echo "My name is $name"
  3. Using Options:

    • -n: Do not output the trailing newline.
    • -e: Enable interpretation of backslash escapes.

    Example with options:

    echo -e "Line 1\nLine 2"

This command is widely used for debugging and displaying messages in scripts.

0 Comments

no data
Be the first to share your comment!