Sunday, 17 April 2016

How to write professional shell scripts ?


Writing shell script professionally

Tip 1. Write some Meta data which give info about the script. Preferabally -
         a. Shebang statement (#!/bin/bash)
         b. Script purpose
         c. Author details
         d. Creation date
         e. Modification date and details/reason of modification


Tip 2. Provide as much info as possible if there is a complex command.

Tip 3. Try to use vim editor instead of just normal vi editor. (Vim editor uses color codes for different commands and control statements)

Tip 4. Try to check if all the open brackets are closed or not before executing it.

Tip 5. Try to use $? Inbuilt variable to check the previous command status.

Tip 6. Try to use tab’s for better writing of the script to make others to understand quickly.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.