help-bash
[Top][All Lists]
Advanced

[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: Steve Amerige
Subject: Re: SECONDS=0 does not reset SECONDS, or I'm missing something
Date: Thu, 4 Jun 2020 09:29:15 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1

I was offering some best practice advice as I don't think I'm constrained to answer just the question. :-)

I generally welcome best practice advice in this distribution list as subscribers tend to use this list not just to get their own questions answered, but also learn from others in the process.
Please do feel free to ignore any comments that you are not interested in.

Enjoy and have a great day,
Steve Amerige

On 6/4/2020 9:00 AM, Andreas Kusalananda Kähäri wrote:
Also, as a side note, if your script were running with set -o errexit,
the conditional idiom would fail because it doesn't handle the false case.
Better:

if (( SECONDS > 0 )); then
    sleep $SECONDS
fi

I don't understand this, or what it has to do with my issue.  Setting
errexit in the shell would not terminate the script due to a failure in
my AND-list (unless sleep somehow failed).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]