in reply to Checking for valid directory

You may want to check whether it exists (-e), can be read (-r) and that you can cd into it (-x) apart from the check you're already doing. I'd do the -e first for obvious reasons ;-)

See the docs for more details.

Hope this helps, -gjb-