Sunday, 6 July 2008

Hello World program examples

Hello World is the first program every user usually codes when he learns a new programming language.

Its goal is learning the basics to edit, compile and execute a program which sends a "hello world" string to standard output.

We have used an Ubuntu Hardy distro based system. Most commands will serve to other distros as well, like Debian.

BASH Shell Scripting Hello World

bash command line interpreter is usually already installed in your system.

if it is not installed we type: $sudo aptitude install bash

Now we create script using whatever text editor we prefer.
e.g: $ gedit

Copy this lines into your script
echo "hello world"

Bash shell scripting is an interpreted language so we have not to compile anything. We directly execute the shell script file:

We give the shell script execution permissions:
$ chmod a+x

and launch the program
$ ./

PYTHON Scripting Hello World

If you do not have python installed in your system, exec:

$ sudo aptitude install python