Displaying Messages
Most shell commands produce their own output, which is displayed on the console monitor where the script is running. Many times, however, you will want to add your own text messages to help the script user know what is happening within the script. You can do this with the echo
command. The echo
command can display a simple text string if you add the string following the command:
$ echo This is a test
This is a test
$
Notice that by default you don't need to use quotes to delineate the string you're displaying. However, sometimes this can get tricky if you are using quotes within your string:
$ echo Let's see if this'll work
Lets see if thisll work
$
The echo
command uses either double or single quotes to delineate text strings. If you use them within your string, you need to use one type of quote within the text and the other type to delineate the string:
$ echo "This is a test to see if you're paying attention"
This is a test to...