🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.user
Article #242

Re: Bash: check if a value is into an array

#242
From: Michel Verdier
Date: Thu, 22 Oct 2026 09:30
15 lines
1880 bytes
On 2026-10-21, Greg Wooledge wrote:

>     IFS=:
>     [[ ":${x[*]}:" =~ ":$i:" ]] ...
>     unset IFS

Would it be safer to restore IFS ?
With something like

  OLDIFS=$IFS
  IFS=:
  ...
  IFS=$OLDIFS

or using local if within a function
Technical Details
Message-ID: <NQXhv-79Iz-9@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!news.servidellagleba.it!bofh.it!news.nic.it!robomod
References: <NQFND-6ZMU-9@gated-at.bofh.it> <NQG6Z-703J-7@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!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From: Michel Verdier <listes@verdier.net>
Newsgroups: linux.debian.user
Subject: Re: Bash: check if a value is into an array
Date: Thu, 22 Oct 2026 11:30:01 +0200
Message-ID: <NQXhv-79Iz-9@gated-at.bofh.it>
References: <NQFND-6ZMU-9@gated-at.bofh.it> <NQG6Z-703J-7@gated-at.bofh.it>
X-Mailbox-Line: From debian-user-request@lists.debian.org  Thu Oct 22 09:23:52 2026
Old-Return-Path: <listes@verdier.net>
X-Amavis-Spam-Status: No, score=-2.1 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] autolearn=ham autolearn_force=no
X-Policyd-Weight: using cached result; rate: -4.6
User-Agent: Gnus
Mail-Copies-To: never
MIME-Version: 1.0
Content-Type: text/plain
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/832550
List-ID: <debian-user.lists.debian.org>
List-URL: <https://lists.debian.org/debian-user/>
List-Archive: https://lists.debian.org/msgid-search/877bjaxf54.fsf@verdier.net
Approved: robomod@news.nic.it
Lines: 15
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Thu, 22 Oct 2026 11:23:35 +0200
X-Original-Message-ID: <877bjaxf54.fsf@verdier.net>
X-Original-References: <fb4588c5-2637-4714-81e6-791a9260afbd@gmail.com>
	<20261021150743.GA21484@wooledge.org>