Yeeh, that's funny indeed :) Now this:
time ( test2Y=$(stat -c %Y test2); for (( i=0; i<1024; i++ )); do if (( $(stat -c %Y test1) < ${test2Y} )); then echo >> /dev/null; else echo >> /dev/null; fi; done; ); real 0m4.503s user 0m1.048s sys 0m3.240s time ( for (( i=0; i<1024; i++ )); do if [[ -N test1 ]]; then echo >> /dev/null; else echo >> /dev/null; fi; done; ); real 0m0.034s user 0m0.023s sys 0m0.009s On Fri, 2021-11-12 at 12:16 -0500, Lawrence Velázquez wrote: > On Fri, Nov 12, 2021, at 4:36 AM, Mischa Baars wrote: > > Using Fedora 32 (bash 5.0.17) this returns a true, while on Fedora 35 (bash > > 5.1.8) this returns a false: > > touch test; if [[ -N test ]]; then echo true; else echo false; fi; > > > > [...] > > > > As I understand it, -N stands for NEW and therefore should return a true > > when either a 'touch -a test' or a 'touch -am test' is given. > > FWIW, there's some disagreement on this. > > % cat foo_test > test -N foo > echo "$?" > % touch foo > % /bin/bash -c 'echo "$BASH_VERSION"; . ./foo_test' > 3.2.57(1)-release > 0 > % /opt/local/bin/bash -c 'echo "$BASH_VERSION"; . ./foo_test' > 5.1.8(1)-release > 1 > % ksh -c 'echo "${.sh.version}"; . ./foo_test' > Version AJM 93u+ 2012-08-01 > 1 > % yash -c 'echo "$YASH_VERSION"; . ./foo_test' > 2.51 > 1 > % zsh -c 'echo "$ZSH_VERSION"; . ./foo_test' > 5.8 > 0 >