2012-05-25

double colons in Bourne Shell function names

Bourne shell does not like double colons ("::") in identifiers. Other shells, e.g. bash, have no problems with them, and programmers like to use them for generating a pseudo-namespace look.

A problem arises when I want to write an include file that works for both, bash and sh.

Here is a workaround that lets me define function names in Bourne Shell with double colons in their name:

function foo__bar() {
  ...
}

alias foo::bar=foo__bar

No comments:

Post a Comment