bug-bash
[Top][All Lists]
Advanced

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

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


From: Peter D.
Subject: Subject: -nt and -ot tests do not give errors on non existent files.
Date: Sat, 2 Oct 2004 11:59:40 +1000
User-agent: KMail/1.6.1

Hi,

My apologies if I have made multiple posts - the first attempts do not 
seem to have arrived.  Google groups is not showing them in gnu.bash.bug.

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:

        [psd@c17] ~ ->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
        
        [psd@c17] ~ ->bash bug
        imaginary file older than real file
        bug: line 7: [: -ot: unary operator expected
        [psd@c17] ~ ->

Fix:



-- 
Peter D.
Sig goes here...

reply via email to

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