Today I wrote this little snippet:
LATEST_PARSEC_LIB="$(cd $HOME && ls parsecd-*.so | sort -V | tail -1 || true)"
[[ -z "${LATEST_PARSEC_LIB}" ]] && find "$HOME/" -maxdepth 1 -regex '^parsec-.*\.so$' -type f ! -newer "${HOME}/${LATEST_PARSEC_LIB}" ! -name "${LATEST_PARSEC_LIB}" -delete
It does quite some interesting stuff, like detecting the latest installed version of parsec, removing all older versions but the latest one.
Then I thought about it and noticed: Too smart, will cause problems.
@sheogorath As a legendary programmer wrote, “Exploit the limitations of your problem.” You rarely need to solve the general problem. Overly general code always leads to strange stuff in the actual application. I think this relates to what you wrote above.