shell Hello World


Example

At the command prompt:

$ echo "Hello World"

Output:

Hello World

To create a script, create a text document with the following content:

#!/bin/sh
echo "Hello World"

Save the script with the name hello.sh (or any filename) and make the script executable by giving the following permission:

$ chmod 755 hello.sh

Or:

$ chmod +x hello.sh

Run the script:

$ ./hello.sh

Output:

Hello World

To run a local shell script without executable permission:

1.bash

$ bash hello.sh
Hello World

2.ksh

$ ksh hello.sh
Hello World

3.sh

$ sh hello.sh
Hello World