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. for me also The code gives the following exception
View Tutorial          By: ashitha at 2007-09-12 03:09:12

2. what about object bean with view scope ??
View Tutorial          By: abdelaziz akharraz at 2012-10-09 15:06:52

3. 29. It is not a deadlock. What will actually happe
View Tutorial          By: Sasha at 2012-01-24 14:34:03

4. concept of static keyword is beautifully explained
View Tutorial          By: jaideep aswal at 2012-04-14 07:21:56

5. Good intro..
View Tutorial          By: thirunavukkarasu at 2015-01-30 17:32:10

6. You should check out the new BonCode connector for
View Tutorial          By: Petro Donic at 2012-07-16 02:34:06

7. I want to download that 5 sms sending program .fro
View Tutorial          By: anwar at 2008-09-08 02:22:06

8. Thnx A Lot...very healpful...........
View Tutorial          By: vinay at 2012-07-19 09:21:20

9. can't understand........
View Tutorial          By: james at 2011-06-23 02:44:22

10. i tried your code but i got an error on this line<
View Tutorial          By: edward at 2011-12-09 11:32:30