[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash conditional expressions
From: |
Chet Ramey |
Subject: |
Re: bash conditional expressions |
Date: |
Mon, 15 Nov 2021 09:36:40 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 |
On 11/12/21 12:16 PM, Lawrence Velázquez wrote:
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.
Not very much.
% cat foo_test
test -N foo
echo "$?"
% touch foo
% /bin/bash -c 'echo "$BASH_VERSION"; . ./foo_test'
3.2.57(1)-release
0
Yes, this is the substance of the bug report. That version of the bash
builtin `test', which is around 15 years old, did it wrong. It was
finally fixed in bash-5.1.
% /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
So zsh is the outlier.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- Re: bash conditional expressions, (continued)
- Re: bash conditional expressions,
Chet Ramey <=
Re: bash conditional expressions, Dale R. Worley, 2021/11/14
Re: bash conditional expressions, Chet Ramey, 2021/11/15
Re: bash conditional expressions, Chet Ramey, 2021/11/17