5.1. echo

Use echo to display lines of text or variables or to direct strings into files. The general format is:

echo string 

The echo command comes with many features, but the most useful ones are as follows:

\c do not go to the next line
\f formfeed
\t tab
\n newline

To keep the prompt at the end of your string use:

						$ echo  "What is your name :\c" 
$ read name
					

The output from the above would display:

						What is your name :
						

where ‘’ is the cursor.

To echo a string and let the cursor go to the next line use:

						$ echo "The red pen ran out of ink" ...

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.