Tuesday, August 05, 2008

Basic shell scripting - quick guide

A shell is a command line interpretor. It takes commands and executes them. on Unix and Unix base system Bourne shell is used to create shell scripts.

Writing shell script can save you a lot of work and time on doing repetitive task, such as deleting core files to free up space, sending backup status to your email, doing batch job such as parsing batch of files and logs.

This quick basic how to will show you what a shell script look like with a very basic example below

All Bourne shell script starts with #!/bin/sh


echo " What is your name?"
read name


echo "Hello $name, These are your files $name"

ls .

After copying and pasting the script you need to chmod 777 the file to be able to execute it, the sample script will ask for your name and list the content of your current directory, if you want to learn more visit the links below for more info

Basic shell
How to write a shell script
Advance Scripting Guide

No comments:

For suggestion and concerns E-mail