bug-bash
[Top][All Lists]
Advanced

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

Re: efficient way to use matched string in variable substitution


From: Léa Gris
Subject: Re: efficient way to use matched string in variable substitution
Date: Tue, 24 Aug 2021 13:31:35 +0200
User-agent: Telnet/1.0 [tlh] (PDP11/DEC)

Le 23/08/2021 à 21:41, L A Walsh écrivait :


On 2021/08/23 12:10, Greg Wooledge wrote:
On Mon, Aug 23, 2021 at 11:36:52AM -0700, L A Walsh wrote:
Starting with a number N, is there
an easy way to print its digits into an array?

n=988421

# Need extglob for the replacement pattern
shopt -s extglob

# Split string characters into array
IFS=' ' read -r -a array <<<"${n//?()/ }"

# Debug print array
declare -p array

--
Léa Gris




reply via email to

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