Prerequisite : Bubble Sort
Given an array arr sort the array in ascending order using bash scripting.
Input : 9 7 2 5 Output : Array in sorted order : 2 5 7 9
For sorting the array bubble sort is the simplest technique. Bubble sort works by swapping the adjacent elements if they are in wrong order .
Given array - (9, 7, 2, 5) After first iteration - (7, 2, 5, 9) After second iteration - (2, 5, 7, 9) and so on...
In this way, the array is sorted by placing the greater element at the end of the array .
Array in sorted order : 8 10 12 20 100
- Write a bash script to print a particular line from a file
- Bash program to check if the Number is a Prime or not
- Fibonacci Series in Bash
- Useful and time saving bash commands in Linux
- Average of given numbers in Bash
- Bash program to find A to the power B
- Bash program to check if the Number is a Palindrome
- Simple Calculator in Bash
- Bash shell script to find sum of digits
- Programs for printing different patterns in Bash
- Bash shell script to swap two numbers
- Bash Script to get Low Battery Alert in Linux
- Bash shell script to find out the largest value from given command line arguments
- How to Fix Minimal BASH Like Line Editing is Supported GRUB Error In Linux?
- Leap Year Program with Bash Shell Scripting in Windows
- SORT command in Linux/Unix with examples
- Array Basics Shell Scripting | Set 2 (Using Loops)
- Formatted text in Linux Terminal using Python
- Encrypt/Decrypt Files in Linux using Ccrypt
- Operations on Audio/Video files using ffmpeg, avconv, and youtube-dl
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nitin_19520