in reply to Appending in a switch case statement

Sounds like you want CDPATH. Given the following entry in .bash_profile,
export CDPATH=.:~:~/www:~/tmp

you get the desired behaviour with cd:

[~]$ cd bin /home/ikegami/bin [~/bin]$ cd lib /home/ikegami/lib [~/lib]$ cd example.com /home/ikegami/www/example.com [~/www/adaelis.com]$

It'll save you from writing a bash parser (although a half-assed one should work).