Tuesday, July 13, 2010

Writing A little shell scripting

Here we are going to write a little shell Program.
First open the terminal and then issue following commands
vi firstscript.sh

Now you are created a file called "firstscript" and going to enter shell programming syntax. Enter following simple script.

#!/bin/bash //make this document a script file
# Display text using a function
function textdis
{
echo "Welcome to my Shell Scripting world";
}
textdis; //execute the function



Press Ctrl^d // on your keyboard to save the document

Now give permission for execution -> chmod +x firstscript.sh
Now execute the script file -> ./firstscript.sh



No comments:

Post a Comment