Comment on Tutorial - Sort numbers using arrays in Shell Script By Vivek G



Comment Added by : shruthi

Comment Added at : 2013-01-18 06:00:08

Comment on Tutorial : Sort numbers using arrays in Shell Script By Vivek G
This will give the output check it out

nos=( 2 4 1 30 23 )
echo "Original Numbers in array:"
for ((i = 0; i <= 4 ; i++ ))
do

echo " ${nos[i]} "
done


for (( i = 0; i <= 4 ; i++ ))
do
for (( j = $i; j <= 4; j++ ))
do
if [ ${nos[i]} -gt ${nos[j]} ]; then
t=${nos[i]}
nos[i]=${nos[j]}
nos[j]=$t
fi
done
done

echo -e "\nSorted Numbers in Ascending Order:"
for (( i=0; i <= 4; i++ ))
do
echo "${nos[i]}"
done


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. yesh this is very help full for every body.
View Tutorial          By: venkat at 2010-06-29 12:18:57

2. nice one ...
View Tutorial          By: vamsi at 2011-11-11 06:41:25

3. can we use this code in a web application. your he
View Tutorial          By: phani at 2008-09-17 06:15:26

4. Hi There Busy doing a project and found that i cou
View Tutorial          By: Steven Owen Nell at 2010-09-05 13:32:01

5. I am getting this exeception when trying to send m
View Tutorial          By: praveen at 2012-12-27 11:15:14

6. ' REFERENCIA EN EL PROYECTO (Microsoft Excel 12.0
View Tutorial          By: Anonymous at 2015-04-21 03:10:41

7. # include <iostream.h>
int main ()
View Tutorial          By: nazarine at 2011-07-06 06:17:10

8. Error loading win32com: java.lang.UnsatisfiedLinkE
View Tutorial          By: Dinesh557 at 2008-09-23 04:18:47

9. Nice one for jsp learners.
View Tutorial          By: Vignesh at 2011-07-14 04:04:55

10. This is good for beginners.
View Tutorial          By: sathish at 2011-04-05 11:37:30