Execute md5sum on a string inside a variable

How can I execute the bash command

echo -n "%Variable%someString%" | md5sum

Where someString is derived from a KM_Variable.

Execute text script gives an error

See here (KM Wiki) for the variable syntax in shell scripts.

So this should work:

echo -n "$KMVAR_someString" | md5sum

where someString is the name of your KM variable.

It works without the path in Terminal, In KM had to do this

echo -n "$KMVAR_someString" | /usr/local/bin/md5sum

If you want, you can also set your paths globally, that is, for all KM macros, so that you don’t have to explicitly add the path each time: KM Wiki (scroll down to “Setting the ENV_PATH Keyboard Maestro Variable”).