bug-bash
[Top][All Lists]
Advanced

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

-nt and -ot tests do not give errors on non existent files.


From: Peter D.
Subject: -nt and -ot tests do not give errors on non existent files.
Date: Mon, 20 Sep 2004 22:09:12 +1000
User-agent: KNode/0.7.6

Configuration Information [Automatically generated, do not change]:
Machine: i586
OS: linux-gnu
Compiler: i586-mandrake-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-mandrake-linux-gnu' 
-DCONF_VENDOR='mandrake' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib 
-D_GNU_SOURCE  -O2 -fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro 
uname output: Linux c17 2.6.3-16psd #6 Fri Sep 17 21:49:43 EST 2004 i686 
unknown unknown GNU/Linux
Machine Type: i586-mandrake-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        When trying to compare the age of a non-existent 
        file it would be reasonable to behave like the 
        file name was missing (and stop) or to at least 
        print a warning to standard error.

Repeat-By:

        address@hidden ~ ->cat bug
        #!/bin/bash
        
        if [ no/such/file -ot /etc/fstab ] ; then
                echo "imaginary file older than real file"
        fi
        
        if [ -ot /etc/fstab ] ; then
                echo "imaginary file older than real file"
        fi
        
        address@hidden ~ ->bash bug
        imaginary file older than real file
        bug: line 7: [: -ot: unary operator expected
        address@hidden ~ ->

Fix:



-- 
Peter D.
Sig goes here...


reply via email to

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