bash - quote dirname to avoid errors