"source" vs "."

Gerard Beekmans gerard at linuxfromscratch.org
Fri Jan 23 20:09:02 PST 2009


> "source" or ".": which one do you prefer and why?

This is purely a personal preference and a matter of taste. It's not 
based on one being more technically correct over another.

When there is a choice in the matter, I prefer to use "source" because I 
find it overall easier to read and interpret.

I think a similar point can be used when naming variables in scripts and 
programs. You can name something $i because it's easy to type or you can 
name it $current_iteration which is annoying to type over and over 
again. To somebody else reading your code, it's a lot more descriptive 
and you can quicker find out what a script is doing. Or better, what 
it's supposed to be doing but due to a bug it isn't.

If you're writing scripts or programs for yourself, and you know what a 
'dot' does versus 'source' it likely doesn't matter and you may find 
yourself using the dot because it's less to type. If you mean for your 
scripts to be read and used by others, you may decide to use the full 
word 'source' for clarity.

Gerard





More information about the lfs-chat mailing list