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:
-
Basic Usage:
echo "Hello, World!" -
Displaying Variables:
name="Labby" echo "My name is $name" -
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.
