there is shopt or var option about do defaultly reference or dereference
might have influence here
also its -h and -L
help test
On Fri, Mar 26, 2021 at 10:20 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> Hi,
>
> ln -s 1.txt a.txt
> [[ -a a.txt ]]; echo $?
> 1
> [[ -e a.txt ]]; echo $?
> 1
>
> [[ -e path ]] and [[ -e path ]] will deference symlink. If the target
> does not exist, it will return an error.
>
> I want to check the existence of a path without dereferencing symlink.
> I come up with this, but it is a little verbose. Is this the best way
> to do so?
>
> [[ -f path || -h path || -d path ]]
>
> --
> Regards,
> Peng
>