Article View: linux.debian.user
Article #276Re: Bash: check if a value is into an array
From: Anssi Saari
Date: Fri, 23 Oct 2026 14:20
Date: Fri, 23 Oct 2026 14:20
12 lines
2500 bytes
2500 bytes
The Wanderer <wanderer@fastmail.fm> writes:
> $ echo {1..10}
>
> , the 'for i in {1..10}; do' is exactly equivalent to 'for i in 1 2 3 4
> 5 6 7 8 9 10 ; do'.
The coolest thing about this brace expansion is that you can even get
the numbers zero padded for a fixed width, like maybe for filenames or
tabular data.
So echo {01..10} outputs 01 02 03 04 05 06 07 08 09 10.
Technical Details
Message-ID:
<NRohI-7plk-21@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.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> <NQJRf-729Y-1@gated-at.bofh.it> <NR1br-7bQc-11@gated-at.bofh.it> <NRohI-7plk-23@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.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod From: Anssi Saari <anssi.saari@debian-user.mail.kapsi.fi> Newsgroups: linux.debian.user Subject: Re: Bash: check if a value is into an array Date: Fri, 23 Oct 2026 16:20:02 +0200 Message-ID: <NRohI-7plk-21@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> <NQJRf-729Y-1@gated-at.bofh.it> <NR1br-7bQc-11@gated-at.bofh.it> <NRohI-7plk-23@gated-at.bofh.it> X-Original-To: debian-user@lists.debian.org X-Mailbox-Line: From debian-user-request@lists.debian.org Fri Oct 23 14:19:01 2026 Old-Return-Path: <gldu-debian-user-2@m.gmane-mx.org> X-Amavis-Spam-Status: No, score=-1.65 tagged_above=-10000 required=5.3 tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25] autolearn=no autolearn_force=no X-Policyd-Weight: using cached result; rate:hard: -4.6 X-Injected-Via-Gmane: http://gmane.org/ Organization: An impatient and LOUD arachnid MIME-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:3Y720h9myJ4DVxsS0hkshDVIsiA= X-Eternal-September-Date: Friday September 12106th, 1993 Mail-Followup-To: debian-user@lists.debian.org X-Mailing-List: <debian-user@lists.debian.org> archive/latest/832588 List-ID: <debian-user.lists.debian.org> List-URL: <https://lists.debian.org/debian-user/> List-Archive: https://lists.debian.org/msgid-search/sm0se1wfqki.fsf@lakka.kapsi.fi Approved: robomod@news.nic.it Lines: 12 Sender: robomod@news.nic.it X-Original-Date: Fri, 23 Oct 2026 17:18:37 +0300 X-Original-Message-ID: <sm0se1wfqki.fsf@lakka.kapsi.fi> X-Original-References: <fb4588c5-2637-4714-81e6-791a9260afbd@gmail.com> <20261021150743.GA21484@wooledge.org> <b397ac30-dbff-4822-b314-c6cc97dc0df8@gmail.com> <20261021190429.GA28455@wooledge.org> <02f8c2b4-80ec-4f0a-a277-3f1c80acd476@gmail.com> <6ADA15E3.2000204@fastmail.fm>