#!/bin/bash# Prompt the user for the number of elementsread -p "Enter the number of elements: " n
# Declare an arraydeclare -a arr
# Read array elements from the userread -p "Enter elements: " -a arr
# Bubble Sort logicfor((i =0; i < n -1; i++));dofor((j =0; j < n - i -1; j++));do# Correctly compare the adjacent elementsif["${arr[j]}" -gt "${arr[j + 1]}"];then# Swap the elementstemp="${arr[j]}" arr[j]="${arr[j + 1]}" arr[j + 1]="$temp"fidonedone# Output the sorted arrayecho -n "Sorted array: "forelementin"${arr[@]}";doecho -n "$element "doneecho# Newline after printing the sorted arrayo