In a prior life I used zsh and learned to love its show-current-directory-trimmed-to-length prompt code, but these days I've succumbed to inertia and use bash.
With much messing around, I managed to figure out how to replicate the same functionality in bash:
With much messing around, I managed to figure out how to replicate the same functionality in bash: