On Thu, Oct 03, 2013 at 03:18:16AM -0700, vic...@vsespb.ru wrote: > -e will return file not exists, even if it does, when permission denied error > happen. I am wondering if this documented/correct behaviour or no.
I assume you mean that bash will return 1 (failure) for [[ -e /path/to/file ]] when bash does not have search/execute privileges on all the directories in /path/to/. In which case, bash cannot stat() the file to see whether it exists. imadev:~$ mkdir -p /tmp/a/b/c imadev:~$ touch /tmp/a/b/c/file imadev:~$ [[ -e /tmp/a/b/c/file ]]; echo $? 0 imadev:~$ chmod 000 /tmp/a/b/c imadev:~$ [[ -e /tmp/a/b/c/file ]]; echo $? 1 How else would you expect bash to handle this?