On 4/17/25 10:21 PM, Mike Wright wrote:
I'm trying to write a bash script.  There are 4 arrays: base10 base16 base62 base70.

I want to match an array based on two digits provided by argument $1.

e.g.  getArray 70 would select base70

This should show what you need.

#/usr/bin/bash

array1=(1 2 3 4)
array2=(5 6 7 8)
array3=(9 10 11 12)

declare -n arr=array${1}
echo ${arr[$2]}

--
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to