What Is Echo in Unix Shell Scripting?


Larry Thompson

In Unix shell scripting, the echo command is used to display text or values on the terminal. It is a versatile and frequently used command that allows you to provide output to the user, print variables, or display messages for debugging purposes.

Basic Syntax

The basic syntax of the echo command is:


The [OPTION] parameter is optional and can be used to modify the behavior of the echo command. The [STRING] parameter represents the text or value that you want to display.

Displaying Text

To display a simple text message using the echo command, you can provide the text within quotes:

echo "Hello, World!"

This will output:

Hello, World!

Bold Text

You can emphasize certain parts of your message by using bold text. To achieve this effect in HTML, you can use the <b> tag around the desired text:

<b>Hello,</b> World!

This will output:

Hello, World!

Underlined Text

If you want to underline specific parts of your message, you can use the <u>tag in HTML. Here’s an example:

Hello, <u>World!</u>

This will output:

Hello, World!

Printing Variables

The echo command is commonly used to print the values of variables. To display the value of a variable, you need to prefix the variable name with a dollar sign ($):

echo "My name is $name"

This will output:

My name is John

Displaying Special Characters

If you want to display special characters, such as double quotes or backslashes, you need to escape them using a backslash (\) before the character. For example:

echo "She said, \"Hello!\"" 

This will output:

She said, “Hello!”


The echo command in Unix shell scripting is a powerful tool for displaying text and variables on the terminal. It allows you to provide feedback to users, print values for debugging purposes, and display messages during script execution. By understanding how to use formatting elements like bold and underline in HTML, you can make your output visually engaging and organized.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy