bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in command "test"


From: Philip Rowlands
Subject: Re: Bug in command "test"
Date: Thu, 18 Sep 2008 17:11:29 +0100 (BST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]