[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash conditional expressions
From: |
Lawrence Velázquez |
Subject: |
Re: bash conditional expressions |
Date: |
Fri, 12 Nov 2021 12:16:19 -0500 |
User-agent: |
Cyrus-JMAP/3.5.0-alpha0-1371-g2296cc3491-fm-20211109.003-g2296cc34 |
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
--
vq
Re: bash conditional expressions, Dale R. Worley, 2021/11/14