Linux ECHO Command
Usage of Linux ECHO Command: This command is very important command widely used in bash and c shells. It is used to display a line of text/string on standard output or a console. Syntax:
echo [ option ( s ) ] [ string ( s ) ] Example1 : Input a line “Hi, this is my session 2” and display on standard output.
$ echo Hi , this is my session 2 Example2 : D eclare a variable x and assign its value let’s say 30. Then, echo its value i.e. print value of x.
$ x = 10 $ echo value of x = $ x Example3 : Print statement “ I Love Linux” with no space using echo.
$ echo “ I \ bLove \ bLinux” Explanation: Usage of \b as backslash interpreter. Example4 : Print all words of a string keeping one word in each line. Lets take string as “I Love Linux”.
$ echo “ I \ nLove \ nLinux” Explanation: \n is used as next line interpreter. Example5 : Print all files and folder in current path using echo command (an alternative of ls command).