El siguiente código trata del método de ordenamiento Shell en bash:
#!/bin/bash
function shell {
lista=$1
tam=${#lista[@]}
for inc in $(seq 1 $[$[inc*3]+1] $[$tam-1]) ; do
while [ $inc -gt 0 ] ; do
for i in $(seq $inc $[$tam-1]) ; do
j=$i
temp=${lista[$i]}
while [[ $j -ge $inc && ${lista[$[$j-$inc]]} -gt $temp ]] ; do
lista[$j]=${lista[$[$j-$inc]]}
j=$[$j-$inc]
done
lista[$j]=$temp
done
inc=$[$inc/2]
done
done
}
lista=(5 4 3 2 1)
shell $lista
for i in ${lista[@]};do echo $i; done

Your article helped me a lot, is there any more related content? Thanks! https://www.binance.info/register?ref=P9L9FQKY
Your article helped me a lot, is there any more related content? Thanks!
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.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
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?
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.