Untitled Document
echo Command

echo command displays the line , text or word provided to it on your terminal . In other words - echo command is used for printing or displaying the line or messages on screen . We have used this command in our shell script . Lets see some more options and examples of echo -

1. Basic example -

 echo "Hello, World!"
 
 Output - Hello World ! 

At the last of output it produces summary of files .

2. Printing an variable Value in shell script

Create a file print.ksh and paste below code in it and run the script to see the echo messages .

   #!/bin/ksh
   x=10
   echo " The Value of variable x is $x : "

   Output - The Value of variable x is : 10

3.Removing spaces from message using option -e

Add below highlighted line to file print.ksh and paste below code in it and run the script to see the echo messages ..

   #!/bin/ksh
   x=10
   echo " The Value of variable x is $x : "
   echo -e "Here \bthe \bspaces \bare \bremoved."

   Output - The Value of variable x is : 10

            thespacesareremoved 

4. Print the list of files in an directory -

The command echo with * prints all the files and directories from current directory .

echo * 
Untitled Document