Sleestak has asked for the wisdom of the Perl Monks concerning the following question:

Anyone know of complete documentation on the file test operators (-r/-w/-x/etc.)?

Specifically I would like documentation on how the file test operators work with symbolic links.

$ ln -s my_dir symlink -l "symlink"; # is true -l "symlink/"; # is false

Are the permissions on the symlink ever important? Do the -x/-r/-w test check the link or the thing point to?

I realize that I could try to think of all the combinations and test them but I'm lazy.

Thanks.

Replies are listed 'Best First'.
Re: File test operators...
by japhy (Canon) on Mar 15, 2001 at 03:26 UTC
    I believe the reason that "symlink/" is not a symbolic link is because "directory/" is shorthand for "directory/.", and "symlink/." is (hopefully) not a symlink.

    japhy -- Perl and Regex Hacker
Re: File test operators...
by arturo (Vicar) on Mar 15, 2001 at 03:31 UTC
    perldoc perlfunc and search for '-X', or, if you're lazy (not in the best way!) try this

    oops subtler question than that, wasn't it? mea culpa!

    Philosophy can be made out of anything. Or less. -- Jerry A. Fodor

Re: File test operators...
by buckaduck (Chaplain) on Mar 15, 2001 at 03:38 UTC
    Maybe this is specific to the OS and/or the Perl version. I did this with Perl 5.005 on Solaris 7 and (-l "symlink/") evaluated TRUE.

    I did this with Perl 5.005 on HP/UX 10.20 and it evaluated FALSE.

    What does everyone else get?

    buckaduck