Let’s say you have system access to a very long sting, like a git commit SHA.

You want to use the SHA to identify something related to the commit, but you don’t need the whole string. Just enough of it to make sure it is unique. Lets say the first 10 or 11 characters. here’s some reasoning behind that size

No prob. bash gives us an easy to to access a substring within a larger string, using Parameter Expansion.

commitSha="21093b6686d69d97d6a84d3b8c8ce71cb77aa268"

miniSha=${commitSha:0:11}

echo $miniSha
#=> 21093b6686d