Thursday, September 10, 2015

How to create bash script on Lubuntu


In this article i will show you how to create a simple bash script on lubuntu, so this article is for beginners who who wants to learn about shell script/bash script.

By default lubuntu and ubuntu support for bash script, so basically we don't need to install anything, we just need to create the script and execute it.

For this tutorial we are going to create a hello world script, it's very simple program that anybody can make, alright let's get going.

Step by step how to create helloworld bash script on lubuntu:
  • open command line/console and then run this command:
  • leafpad helloworld.sh
  • inside leafpad write the helloworld program like this:
  • #!/bin/bash
    
    echo "hello world"
    echo "this is my first script"
  • exit leafpad and back to command line/console
  • on command line/console give permission to execute to helloworld.sh
  • chmod +x helloworld.sh
  • run helloworld.sh by typing this command:
  • ./helloworld.sh

Congratulation you have just create a bash script/program, very easy isn't it? note that you can create and edit bash script using any text editor not just leafpad.

But because leafpad is the default GUI text editor on lubuntu, so for this tutorial i show you using leafpad, but you can use other text editor if you want.


No comments:

Post a Comment