On Thu, 18 Sep 2008, Abhishek Verma wrote:

I have been training UNIX for a few months, and have come across a bug (I guess so) With test command.

The problem is, with -f option it reports a symbolic link as a regular file. For ex: say there is a file "f1" of type symbolic link, then

               If [ -f f1 ]; then
                               Echo reg file
               Else
                               Echo Not reg file
               Fi

The above code should give output as : "Not reg file"
But it happens to print "reg file".

This is not a bug - the manpage for test states:
  "Except for -h and -L, all FILE-related tests dereference symbolic
   links.

If the filename passed to test is a symlink, the target of the link is tested as a file/directory/etc.


Cheers,
Phil


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to