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