Tip: Use dots in Bash function names for readability

In default mode, a function name can be any unquoted shell word that does not contain $. - bash man

Therefore if we are writing modern bash and are not concerned about making it POSIX compliant we are allowed to use DOTs as part of bash function names to increase readability. My take is that we should use dots in bash function names for the qpurpose of enhancing readability.

Example how a function name could look like with and without usage of dots.

Proposed function name example:

jq.filter.field_contains

Attempt to name functions without dots:

Attempt using a mix of "-" and "_" to separate parts of function name:

jq_filter_field-contains

jq-filter-field_contains

Attempt to use double __ for namespace separation

jq__filter__field_contains

Use dots and underscores

  • Use dots to delineate namespace like separation of functions.
  • Use underscores to separate words.

Examples:

jq.filter.field_contains
jq.filter.field_equals
jq.filter.field_greater_than