Article View: linux.debian.user
Article #255Re: Bash: check if a value is into an array
From: Max Nikulin
Date: Thu, 22 Oct 2026 16:10
Date: Thu, 22 Oct 2026 16:10
10 lines
3500 bytes
3500 bytes
On 22/10/2026 1:48 am, Nicolas George wrote: > By the way, it seems what you want is not just distinct elements but all > the elements too: a permutation. For that, there is a much more > efficient algorithm: swap the first element randomly with any of the > elements, then the second with any of the elements except the first, > etc. shuf(1) or, as it is recommended there, (info "(coreutils) shuf invocation") Unless the real goal is to explore BASH arrays.
Technical Details
Message-ID:
<NR3wB-7dhY-3@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomodReferences:
<NQFND-6ZMU-9@gated-at.bofh.it> <NQG6Z-703J-7@gated-at.bofh.it> <NQJod-71PP-13@gated-at.bofh.it> <NQJxT-71Ty-3@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod
From: Max Nikulin <manikulin@gmail.com>
Newsgroups: linux.debian.user
Subject: Re: Bash: check if a value is into an array
Date: Thu, 22 Oct 2026 18:10:01 +0200
Message-ID: <NR3wB-7dhY-3@gated-at.bofh.it>
References: <NQFND-6ZMU-9@gated-at.bofh.it> <NQG6Z-703J-7@gated-at.bofh.it> <NQJod-71PP-13@gated-at.bofh.it> <NQJxT-71Ty-3@gated-at.bofh.it>
X-Original-To: debian-user@lists.debian.org
X-Mailbox-Line: From debian-user-request@lists.debian.org Thu Oct 22 16:03:21 2026
Old-Return-Path: <manikulin@gmail.com>
X-Amavis-Spam-Status: No, score=1.236 tagged_above=-10000 required=5.3
tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001,
RCVD_IN_SBL_CSS=3.335] autolearn=no autolearn_force=no
X-Policyd-Weight: using cached result; rate:hard: -5.25
X-Gm-Message-State: AFq9FYIgdJLxQImKjy4W9+2fr8xr5tDI/UoP3qGjKXH1253gCRKUIfpL
vuH1cdlFQTl3Q9kIvgNk0SEXXlt2Nvc1MQHdZnQmPtR9odbMA8yPgxHPpwX+bQ==
X-Gm-Gg: AYBFou1B6vQxH5AgUjGqUu6Yot/vCKpLMHluLzNDx90Gerp5XdtSMgrL9cuc/Jhgun2
whd6siDjVdq81Jm1NP5HcfACwZnxYAcKtcqhldCkHA5wwxDMPbvES9qE8mIwFZKYogGQ8mochWQ
L9nwqiDjQ8sYjWfPsxdt0Npqan5YGjxGQlHh/HQ+xH6FAS+yrKDvY0mmLoWMyhz8wvC1M1zM3vJ
I+rsF/l7ONl2jOO5nl5VFYle6PQj1pwqQws3hLD2iEgrWE1k8Stlndp0h/YwC47KfHVPJcnNfcx
pEgznc8JX9NCdUjVJ/GTp0HeYAgHxy1RZUwqkGrpoNBNgyt97fJs8BIvl0cHfULA8YOOlPZXuZD
T4sI3uvrsPFLZi9xAkmWcPCwWKBIkobLMFAsh2Ao6+MRmxwoOFcBekbLqJidX//il00MlQXtR8N
KsuXJDkJuyRa/bwF5iNFVJCh1Z3hDDIdwYGS1wf0Hf3dxnXAffP8kTvs4nvndsR5eJchQSp2E+c
VOsogTThzodbI1wXtRnJsapocWPkqXu5wFgevKWqzLrFeBwt1SI8yWxB6Ls9msP8eZkzYR2NNIj
l8E=
X-Received: by 2002:a17:907:9812:b0:c1c:4a80:30c4 with SMTP id a640c23a62f3a-c467960c122mr602682266b.11.1792683925185;
Thu, 22 Oct 2026 08:45:25 -0700 (PDT)
Sender: robomod@news.nic.it
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-US, ru-RU
Mail-Followup-To: debian-user@lists.debian.org
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/832566
List-ID: <debian-user.lists.debian.org>
List-URL: <https://lists.debian.org/debian-user/>
List-Archive: https://lists.debian.org/msgid-search/2042bac5-a5ea-4f1b-8922-18ca56ac7206@gmail.com
Approved: robomod@news.nic.it
Lines: 10
Organization: linux.* mail to news gateway
X-Original-Date: Thu, 22 Oct 2026 22:45:21 +0700
X-Original-Message-ID: <2042bac5-a5ea-4f1b-8922-18ca56ac7206@gmail.com>
X-Original-References: <fb4588c5-2637-4714-81e6-791a9260afbd@gmail.com>
<20261021150743.GA21484@wooledge.org>
<b397ac30-dbff-4822-b314-c6cc97dc0df8@gmail.com>
<atkI_Agk3vuY5vlg@phare.normalesup.org>
X-Original-Sender: Maxim Nikulin <m.a.nikulin@gmail.com>