El siguiente código trata del método de ordenamiento por selección en bash:
#!/bin/bash
function selectionsort {
lista=$1
tam=${#lista[@]}
for i in $(seq 0 $[$tam-2]) ; do
min=$i
for j in $(seq $[$i+1] $[$tam-1]) ; do
if [ ${lista[$min]} -gt ${lista[$j]} ] ; then
min=$j
fi
done
aus=${lista[$min]}
lista[$min]=${lista[$i]}
lista[$i]=$aus
done
}
lista=(5 4 3 2 1)
selectionsort $lista
for i in ${lista[@]};do echo $i; done

Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.