Prefetch Technologies // Keeping your cache lines cozy

Calculating variable sizes with bash

While perusing the bash documentation today I came across the ${#} built-in, which can be used to view the size of a variable:

$ foo="some number of characters"
$ echo {#foo}
25

This could be useful for iterating through strings in a loop, and is now part of my shell programming crib notes. Niiiiiiiiiiiiiiiiice!