Saturday, July 23, 2016

Shell Script : Creating and Running a shell script file

OS : Ubuntu 14.04
Steps are as follows:

Step 1: Open Terminal by pressing ctrl+alt+T

Step 2: Use any editor to create a shell script file. 
       
         Sample 1:  sudo gedit firstShell.sh 
         Sample 2:  sudo vim firstShell.sh 
         Sample 3:  sudo vi firstShell.sh 

Step 3: Enter the following line
        
          echo "I am from firstShell.sh file !!!"  
 
Now save the file according to the editor you are using.
Step 4: Modify the attribute of the file as executable file
        

         Sample:  sudo chmod +x firstShell.sh  
 
Step 5: Now RUN the shell script file by entering following command in the terminal

         ./firstShell.sh

No comments:

Post a Comment