Bash to Basics: Print Text with echo

May 14, 2009 by
Filed under: bash, linux 

In the first installment of Command Line Basics, I explained the use of the echo command. In this first installment of Bash to Basics, I'll show how to use the echo command in a script.

Open up a text editor and paste the following text into it.

# This is a demonstration of the echo command

echo Hello World!
echo This is my first bash program.

Affiliate Link

exit 0

Save it as a file called hello1 and exit the text editor.

We now need to make the file executable using the chmod command.

chmod +x hello1

You can now run the script program with the command


Your output should look like

Hello World!
This is my first bash program.

Congratulations! You just wrote a shell script.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>