Skip to main content


Showing posts from October 9, 2011

How to write a simple shell script file

A shell script is the windows equivalent for a batch file. Script files are mainly used to automate tasks or run a series of command with out constant user interaction. There were once really famous way to run automated tasks. There are many GUI based applications that have replaced them, but they have still not lost their charm. Let us see here how to write a simple shell script file. As in all cases, let us say hello to the world..;)

1. Open a simple editor. Create a new file . "sh" is the extension for shell scripts.
2. The first line in any shell script should be, #!/bin/sh . This is used to indicate to the Operating System the type of the file to be processed.
3.  "echo" is a simple command that is used to print values of variables or static content on the console as output. As we wanted to say hello to the world, our second line will be echo "Hello World".

Done. Yes. We are done with our first shell script code. If I was not wrong, th…