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 c...@case.edu http://tiswww.cwru.edu/~chet/