El siguiente código trata del método de ordenamiento burbuja en bash:
#!/bin/bash function burbuja { lista=$1 tam=${#lista[@]} for i in $(seq 1 $[$tam-1]); do for j in $(seq 0 $[$tam - $i - 1]); do if [ ${lista[$j]} -gt ${lista[$j+1]} ] ; then k=${lista[$[$j+1]]} lista[$j+1]=${lista[$j]} lista[$j]=$k fi done done } lista=(5 4 3 2 1) burbuja $lista for i in ${lista[@]};do echo $i; done
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
me cago en tus muertos