Shell script to achieve bubble sort

#!/bin/bash
echo "after sort: KaTeX parse error: Expected'EOF', got'#' at position 13: {array[*]}" # ̲input prompt echo "inpu… {#array[*]} Get the length of the array
let length = KaTeX parse error: Expected'}', got'#' at position 2: {#̲array[*]}-1 #Bubble... length Get the value of length
for((i=0;i < KaTeX parse error: Expected'}', got'EOF' at end of input: …{ for((j=0;j< length-i;j++)){ #here [and the space between the variable cannot be less , Otherwise an error will be reported if [${array[j]} -gt KaTeX parse error: Expected'EOF', got'#' at position 27: …} ];then #̲Exchange data temp… {array[j]}

Guess you like

Origin blog.csdn.net/weixin_45835451/article/details/103888792