in reply to What are -d and -f for?

Other Monks have given you the answer to your question and advice on how to access the documentation. This is to bring to your attention, should you be working in a *nix environment, the fact that a symbolic link to a directory will also give a positive with the -d file test operator. If you wish to distinguish between directories and symbolic links that point to directories you will also have to use the -l file test.

knoppix@Microknoppix:~/data$ mkdir mydir knoppix@Microknoppix:~/data$ ln -s mydir mylink knoppix@Microknoppix:~/data$ ls -l total 4 drwxr-xr-x 2 knoppix knoppix 4096 Aug 13 15:52 mydir lrwxrwxrwx 1 knoppix knoppix 5 Aug 13 15:52 mylink -> mydir knoppix@Microknoppix:~/data$ perl -E ' > say q{-} x 40; > foreach my $thing ( qw{ mydir mylink } ) > { > say > qq{-d test says $thing is }, > -d $thing > ? q{} > : q{not }, > q{a directory}; > say > qq{-l test says $thing is }, > -l $thing > ? q{} > : q{not }, > q{a symlink}; > say q{-} x 40; > }' ---------------------------------------- -d test says mydir is a directory -l test says mydir is not a symlink ---------------------------------------- -d test says mylink is a directory -l test says mylink is a symlink ---------------------------------------- knoppix@Microknoppix:~/data$

I hope this is helpful.

Cheers,

JohnGG