Hi,

--- On Wed, Dec 31, 2008 at 9:22 PM, partha chowdhury
<[email protected]> wrote:
| No magic numbers. Use a variable.
|
| sorry i could not understand what you meant to say. Can you please
| explain a bit ?
\--

It means that one should not "hard-code" strings in code.

    if [ -d /media/backup ]

can be rewritten as:

    BACKUP_DIR=/media/backup
    if [ -d $BACKUP_DIR ]

In future, if /media/backup changes, you only have to replace the
value once in the assignment (BACKUP_DIR=/media/backup), rather than
all instances where you have used them in your script.

http://en.wikipedia.org/wiki/Magic_number_(programming)#Unnamed_numerical_constant

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com
_______________________________________________
Users mailing list
[email protected]
http://lists.dgplug.org/listinfo.cgi/users-dgplug.org

Reply via email to