• Breaking News

    Saturday, 21 November 2015

    HOW TO WRITE SHELL SCRIPT

    What is Shell ?

    In Linux System Shell is program that take command from user and give to system to perform task. We can perform same task from graphical user interface also.


    But if we want to write complex logic then we store complicated commands in script.


    How Setup Script


    1. To write shell script, we need a text editor(vijedit, gedit, whatever you prefer.


    So open Text Editor and write 

    echo "helloworld" 
    

    This will print helloworld



    2. In Next step we have to give permission to file using chmod command so we can read and write file.

    chmod 755 helloworld.sh
    



    3. Now Run Shell script


    /helloworld.sh
    
     .

    You should see "Hello World!" displayed. If your file not present in current directory then you have to go that directory where you file is present and run above command.

    In next tutorial we will see how we add our file to Path so we run file without go to directory where our file is present.

    No comments:

    Post a Comment