March 24, 2013

[HOW TO] Create a script - Linux

This tutorial will show you how to create a script in Linux. In this tutorial I am going to use vi. You can also use gedit or anything else if you want.
Open a terminal and type:
vi (name of the script)
For example "testscript". This will create a script named testscrip.
vi testscript
vi editor will open.
Now its time to start writing your script. Below is an example of a basic script that launches Firefox:
echo “welcome”
Save your script by pressing Esc. Then:
Type :w
Quit vi by:
Typing :q 
Next type the command below to make the script executable:
chmod +x testscript
Finally to run the script type:
That's it! Enjoy creating scripts!

No comments:

Post a Comment