There are two things that are required for this to work properly:
- The `-g` flag to `declare`, ensuring that the shortmap data will be
accessible even if this script is sourced from within a function; and
- Omitting the assignment in the declaration; Bash seems to have a bug
whereby associative arrays initialized in that manner will not be
global.
A co-worker suggested that the command mentioned in the alias provide some
sort of documentation, since that is the only reference the user has for
tracking it down.
When generating the shortmap aliases, there were repeated and unnecessary
invocations of grep; the performance improvement gained by using shell
built-ins is substantial.