Convention/standard for naming files, functions and variables
matthew at linuxfromscratch.org
Sat Jan 3 09:20:32 PST 2009
On Sat, 3 Jan 2009 04:08:26 +0200, "Angel Tsankov" <fn42551 at fmi.uni-sofia.bg> wrote:
> Is there any convention for naming files? I understand that in most cases
> letters are lowercase but I can't figure out when to use underscores and
> when dashes.
I don't think there's any particularly widely used/consulted standard or even
de-facto convention. I happen to use hyphens (probably because I'm lazy and
an underscore requires pressing and holding down the shift-key, whereas the
hyphen doesn't) (on my keyboard and my keymap, YMMV of course).
> I'd also like to know how to name functions in shell scripts,
> which environment variables should be lowercase and which should be
Naming functions in shell scripts should really follow the standard
programming convention of calling them by the verb(s) that most accurately
describe what the function does. e.g. truncate(), replace(), find().
As for environment variables, standard convention is to have them in
uppercase. If, what you're talking about is not environment variables, but
shell script internal variables that don't get exported to/imported from the
environment, I use lowerCamelCase
Again, I'm not sure there's any particular convention or even a style
guide for this. There are some brief points at
Hope this helps,
More information about the lfs-chat