Would anyone have a user-defined function to put in my .basrc to do this. The following example should explain what I have in mind.
Given the following file system:
Level1 Level2 Level3 / TestA ~ - TestB \ TestC - TestB - TestD - CurrentLocation
Assuming the function is called goto.
goto(TestA): Should cd us to the level1 testA directory
goto(TestZ): Should keep us where we are and print something like "not found"
goto(TestB): Should bring us to level2 testB as its the closest.
The search should only ever go up and not down into parent directories as this may match multiple files.