#!/bin/bash servers="server1;server2;server3" IFS=';' read -r -a array <<< "$servers" rand=$[ $RANDOM % ${#array[@]} ] echo ${array[$rand]}