Yes, you could solve this with bash and some string-magic as well. I'm actually moving away from that solution though, as the plan is to get a bit more integrated with the Docker API.
You want to sync & pause containers before taking their data snapshot in some cases, for example.
Also Docker offering multiple kinds of mounts / binds makes things a lot more complicated than they needed be.