The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 03-16-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
and ...

* keep the same form throughout for your code ... inconsistent coding styles make debugging a lot harder regardless of who's doing it ... look at the 3 "if" forms below that people use in ksh scripting --- they do the same things but debugging could be prolonged if you used all of them in the same script instead of just 1 as the patterns are different ...


Code:
form 1: 

if [ cond ]; then
    command
fi

form 2:

if [ cond ]
then
    command
fi

form 3:

[ cond ] && command

* keep the code as simple as possible and then add to it when the basic form works ... write a quick script to test out the functionality first ... if that works, put in error checking and test ... more error checking and test ... you don't want to spend hours on the "perfect" script to learn later that it doesn't really do what you want it to do

* try not to hardcode file and/or directory paths ... makes it easier to test if you could use this or that file instead of the production file or directory ... like indo says --- variables are your friends!

* test as much as possible on a non-production server that closely mirrors the production environment ... unless you want to risk losing live production data --- that could be detrimental to your employment