Re: bash conditional expressions

2021-12-25 Thread L A Walsh
On 2021/11/12 01:36, Mischa Baars wrote: Hi All, All of my makefiles only compile source files and link object files that are NEW, as in the modification timestamp is newer than OR EQUAL TO the access timestamp, such that when I include a new source file into a project or produce a new object fi

Re: bash conditional expressions

2021-11-18 Thread Greg Wooledge
On Thu, Nov 18, 2021 at 07:26:51AM +0100, Michael J. Baars wrote: > So now we have a relation for 'older than' and for 'newer than', but how > about 'oldest' (executable), and 'newest' (executable)? https://mywiki.wooledge.org/BashFAQ/099 The bot in libera's #bash also has this factoid for it:

Re: bash conditional expressions

2021-11-17 Thread Michael J. Baars
On Fri, 2021-11-12 at 19:48 +0100, Andreas Schwab wrote: > FILE1 -nt FILE2 True if file1 is newer than file2 (according to >modification date). > > Andreas. > So now we have a relation for 'older than' and for 'newer than', but how about 'oldest' (executable), and

Re: bash conditional expressions

2021-11-17 Thread Michael J. Baars
On Wed, 2021-11-17 at 14:06 +0200, Ilkka Virta wrote: > On Wed, Nov 17, 2021 at 1:33 PM Andreas Schwab wrote: > > On Nov 17 2021, Michael J. Baars wrote: > > > > > > > > > When -N stands for NEW, and touch (-am) gives you a new file > > > > > > > > It doesn't. The file hasn't been modified

Re: bash conditional expressions

2021-11-17 Thread Chet Ramey
On 11/17/21 5:16 AM, Michael J. Baars wrote: >> Why do you think `touch -am', which sets the atime and mtime to the same >> value, should make -N true? > > When -N stands for NEW It doesn't, though. It could just as easily be a mnemonic for "new activity in the file." You're using it to mean `ne

Re: bash conditional expressions

2021-11-17 Thread Ilkka Virta
On Wed, Nov 17, 2021 at 1:33 PM Andreas Schwab wrote: > On Nov 17 2021, Michael J. Baars wrote: > > > When -N stands for NEW, and touch (-am) gives you a new file > > It doesn't. The file hasn't been modified after it was last read. > touch creates the given file if it doesn't previously exist.

Re: bash conditional expressions

2021-11-17 Thread Andreas Schwab
On Nov 17 2021, Michael J. Baars wrote: > When -N stands for NEW, and touch (-am) gives you a new file It doesn't. The file hasn't been modified after it was last read. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "

Re: bash conditional expressions

2021-11-17 Thread Michael J. Baars
On Fri, 2021-11-12 at 19:48 +0100, Andreas Schwab wrote: > FILE1 -nt FILE2 True if file1 is newer than file2 (according to >modification date). > > Andreas. > This would indeed also solve the problem at hand :)

Re: bash conditional expressions

2021-11-17 Thread Michael J. Baars
On Mon, 2021-11-15 at 09:23 -0500, Chet Ramey wrote: > On 11/12/21 4:36 AM, Mischa Baars wrote: > > > Could you please restore the Fedora 32 behaviour? Someone must have read > > the bash manual a little too precise, because now the statement only > > returns true when a 'touch -a test' is given a

Re: bash conditional expressions

2021-11-15 Thread Chet Ramey
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 "$?"

Re: bash conditional expressions

2021-11-15 Thread Chet Ramey
On 11/12/21 4:36 AM, Mischa Baars wrote: Could you please restore the Fedora 32 behaviour? Someone must have read the bash manual a little too precise, because now the statement only returns true when a 'touch -a test' is given and not when a 'touch -am test' is given. As I understand it, -N st

Re: bash conditional expressions

2021-11-15 Thread Ilkka Virta
On Mon, Nov 15, 2021 at 5:21 AM Greg Wooledge wrote: >relatime > Update inode access times relative to modify or change > time. > Access time is only updated if the previous access time was > ear‐ > lier than the current modify or change t

Re: bash conditional expressions

2021-11-15 Thread Andreas Schwab
On Nov 14 2021, Greg Wooledge wrote: > The significance of "setting the atime" will depend on the mount options > of the file system in question. On Debian 11, a file system of type ext4 > which is mounted with "defaults" (as specified in fstab) includes the > "relatime" option. Which is documen

Re: bash conditional expressions

2021-11-14 Thread Greg Wooledge
On Sun, Nov 14, 2021 at 09:57:49PM -0500, Dale R. Worley wrote: > One thing you have to worry about is how "touch" behaves, and whether > *that* has changed between Fedora versions. I've run a few test uses of > "touch" (in Fedora 34) and examined the consequences with "stat", and > it's not clear

Re: bash conditional expressions

2021-11-14 Thread Dale R. Worley
Mischa Baars writes: > 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; Well, looking at the manual page, I see -N file True if file exists and

Re: bash conditional expressions

2021-11-12 Thread Andreas Schwab
FILE1 -nt FILE2 True if file1 is newer than file2 (according to modification date). Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: bash conditional expressions

2021-11-12 Thread Greg Wooledge
On Fri, Nov 12, 2021 at 02:21:15PM +0100, Mischa Baars wrote: > It is how my makefiles work :) Then they aren't Makefiles. They're BaarsBuilder files or something. > Do you realize how much time it takes to load the stat executable on all > source files [...] What the hell. You're writing

Re: bash conditional expressions

2021-11-12 Thread Michael J. Baars
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; ); real0m4.503s user0m1.048s sys 0m3.240s time ( for (( i=0; i<1024; i++ ));

Re: bash conditional expressions

2021-11-12 Thread Lawrence Velázquez
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 s

Re: bash conditional expressions

2021-11-12 Thread Ilkka Virta
On Fri, Nov 12, 2021 at 3:22 PM Mischa Baars wrote: > It is how my makefiles work :) > Sounds to me you're not using Make, but some self-made tool, so the files you have would be more properly called build scripts or whatever, and not makefiles.

Re: bash conditional expressions

2021-11-12 Thread Alex fxmbsw7 Ratchev
i suggest a bash only makefile script then that spawns few instances of whatever only, i do such whatever overall systems a find printf to comparement is fairly fast, to estimate new files then a good gcc in one cmd done On Fri, Nov 12, 2021, 14:22 Mischa Baars wrote: > Hi Greg, > > It is how my

Re: bash conditional expressions

2021-11-12 Thread Mischa Baars
Hi Greg, It is how my makefiles work :) Do you realize how much time it takes to load the stat executable on all source files and object files? Conditional expressions are already in memory. I prefer using the mtime field, the atime field and conditional expressions. Mischa. On Fri, Nov 12, 20

Re: bash conditional expressions

2021-11-12 Thread Greg Wooledge
On Fri, Nov 12, 2021 at 10:36:01AM +0100, Mischa Baars wrote: > All of my makefiles only compile source files and link object files that > are NEW, as in the modification timestamp is newer than OR EQUAL TO the > access timestamp, That's not how Makefiles work. Makefiles compare the mtimes of two

Re: bash conditional expressions

2021-11-12 Thread Oğuz
> I agree that the `mtime >= atime' behavior should be restored; ``file > is newly created or was accessed since last modified'' is not a useful > information, nor is the opposite. Or, -N can be split into -A (atime > mtime) and -M (mtime > atime), and everyone would be happy :D

Re: bash conditional expressions

2021-11-12 Thread Oğuz
On Fri, Nov 12, 2021 at 12:44 PM 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; This seems to have changed as a result of this bug report: https:/

Re: bash conditional expressions

2021-11-12 Thread Andreas Schwab
On Nov 12 2021, 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; What does `stat test' print respectively? Andreas. -- Andreas Schwab, sch...@lin