Right now i have
listOfFiles = a list of array name like version1, version2,..,version22 // originally sql file
FILES=()
for s in $listOfFiles;
do FILES+=($s);
done
# sort the array into ascending order
Sorted=($(echo ${FILES[*]}| tr " " "\n" | sort -n))
for s in "${Sorted[@]}";
# check existing script files version
do a=$(tr -cd 0-9 <<<"$s");
if [ $a -gt $formerVersion ];
then $(mysql ...//execute the sql);
which executes in order of version1,version10,version11,..,version2,version20,version21,version22, not version1,version2,version3,...version22 as expected