help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case statement with non-consecutive numbers


From: Eli Schwartz
Subject: Re: case statement with non-consecutive numbers
Date: Thu, 15 Apr 2021 17:48:08 -0400

On 4/15/21 5:22 PM, Dennis Williamson wrote:
> On Thu, Apr 15, 2021, 4:17 PM <pauline-galea@gmx.com> wrote:
> 
>>
>> What other options could be available besides
>>
>> for ((i=1; i <= 1000; i++)); do
>>
>> Perhaps using $(seq 1 2 20)
>>
>> Anything else?
> 
> Sequential c-style for loops. But that reduces maintainability due to
> repetition of code.
> 
> There's no reason to use seq unless you're writing for portability.


That's a funny definition of portability, since seq isn't portable.

It's not mandated by POSIX.

It *will* be available on any system running the GNU coreutils, and
FreeBSD/NetBSD do have it, so, depending on which systems you typically
run, your scripts might work, but then one day you might try running
your script on OpenBSD, which doesn't have it according to
man.openbsd.org, and suddenly everything breaks.

There are probably commercial vendors out there that don't have it
either, but those are beyond my ability to trivially research.

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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