[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SECONDS=0 does not reset SECONDS, or I'm missing something
From: |
Andreas Kusalananda Kähäri |
Subject: |
Re: SECONDS=0 does not reset SECONDS, or I'm missing something |
Date: |
Thu, 4 Jun 2020 15:03:00 +0200 |
On Thu, Jun 04, 2020 at 03:00:40PM +0200, Kusalananda Kähäri wrote:
> On Thu, Jun 04, 2020 at 08:48:34AM -0400, Steve Amerige wrote:
> > On 6/4/2020 6:14 AM, Andreas Kusalananda Kähäri wrote:
> > > #!/usr/local/bin/bash -x
> > >
> > > for name do
> > > SECONDS=0
> > > rm -r -f "$name"
> > > [[ SECONDS -gt 0 ]] && sleep "$SECONDS"
> > > done
> > >
> > > What I noticed was that the script would go to sleep for a second
> > > every second, even if the deletion of directories was quick. This
> > > indicates that SECONDS=0 didn't properly reset the SECONDS timer.
> >
> > Note that your script doesn't have a semicolon after "for name":
> >
> > for name; do
> > ...
> > done
>
> That's because it doesn't need one.
>
> >From the manual:
>
> for name [ [ in [ word ... ] ] ; ] do list ; done
>
> That is, "for name in do list; done" is valid.
Sorry, I meant "for name do list; done" above, which is what I have in
my code.
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.
- SECONDS=0 does not reset SECONDS, or I'm missing something, Andreas Kusalananda Kähäri, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Pier Paolo Grassi, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Steve Amerige, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Andreas Kusalananda Kähäri, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something,
Andreas Kusalananda Kähäri <=
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, dan braun, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Pier Paolo Grassi, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Andreas Kusalananda Kähäri, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Greg Wooledge, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Pier Paolo Grassi, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Andreas Kusalananda Kähäri, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Pier Paolo Grassi, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Eli Schwartz, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, dan braun, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Andreas Kusalananda Kähäri, 2020/06/04