Executing Shell Scripts On Linux

by admin on February 4, 2010 · 5 comments

in FAQ, Shell Scripts


The script should have execute permissions for the correct owners in order to be runnable.
if you want to execute a shell file called foo.sh

you have to

chmod +x foo.sh

and then you have to execute it by typing

./foo.sh

Example :
here’s a shell file which will display “Hello World” upon successful execution.

#!/bin/bash
echo "Hello, World!"

Save the above code into a file called hello.sh, then to run it you have to follow the below procedure

chmod +x hello.sh
./hello.sh

Output :
Hello, World!

{ 1 trackback }

Tweets that mention Executing Shell Scripts On Linux | VPS Geek -- Topsy.com
April 24, 2010 at 2:43 pm

{ 4 comments… read them below or add one }

admin February 7, 2010 at 1:26 am

Testing Gravatar :)

Ben February 25, 2010 at 12:30 pm

thanks dude..I was stuck at a shell scrip :D
now I can try many script that I have ! ..
>.<

k March 18, 2010 at 8:19 pm

Need more about shell scripting ….

admin March 29, 2010 at 4:13 am

Hi , thanks for comments ..
I will post some useful shell scripts in future posts..

Leave a Comment

Previous post:

Next post: