There are some other ways to use echo command
Taking input from user:
We create a text file named ” userInput.sh ” and write the following code inside the file.
#!/bin/sh
echo "Enter Your Name : "
read name #It take input from user
echo "Hello, $name. Welcome to w3wiki"
Now run the ” userInput.sh ” with the help of the below code:
$ chmod +x ./userInput.sh $ ./userInput.sh
Output :
Bash Scripting – Bash Echo Command
In this article, we are going to see the echo command. The Echo command is a built-in command feature for Unix / Linux which is generally used to display the text or message on the screen.
Syntax :
$ echo [option]
For Example :
$ echo Geeks For Geeks
Output :
Geeks For Geeks
There are generally three options:
- -n: It does not print the trailing newline.
- -E: It is the default option that disables the implementation of escape sequences.
- -e: It is used to enable interpretation of backslash escapes