bug-bash
[Top][All Lists]
Advanced

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

test -nt operator returns wrong result if only file1 exists


From: Georg-W. Koltermann
Subject: test -nt operator returns wrong result if only file1 exists
Date: Thu, 01 Feb 2001 17:36:53 +0100

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: freebsd4.2
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='freebsd4.2' -DCONF_MACHTYPE='i386--freebsd4.2'
-DCONF_VENDOR='' -DSHELL  -DHAVE_CONFIG_H   -I. -I/usr/local/include -I.
-I./include -I./lib -I/usr/local/include -O -pipe
uname output: FreeBSD hunter.munich.sgi.com 4.2-RELEASE FreeBSD
4.2-RELEASE #0: Tue Jan 23 15:43:47 CET 2001    
gwk@hunter.munich.sgi.com:/usr/src/sys.orig/compile/HUNTER  i386
Machine Type: i386--freebsd4.2

Bash Version: 2.04
Patch Level: 0
Release Status: release

Description:
The builtin command "test file1 -nt file2" returns false if only file1
exists.  In ksh the same command returns true, and I't think that would
be the correct behaviour.

Repeat-By:
        $ bash --version
        GNU bash, version 2.04.0(1)-release (i386--freebsd4.2)
        Copyright 1999 Free Software Foundation, Inc.
        $ touch file1
        $ ls -l file1 file2
        ls: file2: No such file or directory
        -rw-r-----  1 gwk  csdconsult  0  1 Feb 17:29 file1
        $ test file1 -nt file2 && echo true
        $ test file1 -nt file2 || echo false
        false
        $ type test
        test is a shell builtin
        $ 

BUT WITH ksh (on another machine):

        $ ksh
        $ touch file1
        $ ls -l file1 file2
        Cannot access file2: No such file or directory
        -rw-r-----    1 gwk      csdconsul      0 Feb  1 17:34 file1
        $ test file1 -nt file2 && echo true
        true
        $ test file1 -nt file2 || echo false
        $ type test
        test is a shell builtin
        $ uname 
        IRIX
        $ 


Fix:



reply via email to

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