I have the following code:
n=1
a_letters=("a" "b" "c" "d" "e")
while [ $n -le 3 ]; do
uniqueLetters=($(printf '%s\n' "${a_letters[@]}"))
rand=$[ ( $RANDOM % 5)]
echo "${uniqueLetters[$rand]}"
n=$(( $n+1 ))
done
How can I avoid array items that was already printed?
Aucun commentaire:
Enregistrer un commentaire