Zsh Expanding Variables into Arrays or Lists
2
votes
2
answers
377
views
I looked through some of the posted threads and none of them cover my query.
I have a simple line of code below which prints all the ASCII characters:
echo {' '..'~'}
I want to be able to use a variable to substitute this array like below
list="{' '..'~'}"
and then do the following
echo $(print ${list})
To clarify what I am trying to do:
passwordLength="2"
for (( i = 0; i < $passwordLength; i++ ))
do
# concatenate random characters
samplePasswordRegex="$samplePasswordRegex{' '..'~'}"
done
echo $^samplePasswordRegex
Asked by James Bond
(29 rep)
Oct 18, 2024, 07:28 PM
Last activity: Oct 24, 2024, 09:24 PM
Last activity: Oct 24, 2024, 09:24 PM