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



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. Hi.

Mi question is more simple. I w

View Tutorial          By: David at 2010-10-03 04:59:09

2. hi! i want to know about how database createed in
View Tutorial          By: kundan at 2010-05-19 05:03:33

3. super article for freshers and good
View Tutorial          By: santhosh at 2011-11-03 14:32:44

4. Many thanks. I had that problem and your code solv
View Tutorial          By: Gianni at 2009-05-06 10:02:14

5. How to use Shift operators with practicals in java
View Tutorial          By: RosyKrish at 2013-01-17 02:42:37

6. your second last example in above code (Character
View Tutorial          By: jyoti at 2011-11-06 17:01:19

7. import java.io.*;
import java.util.Stack;
View Tutorial          By: jack&jill at 2011-07-26 06:40:32

8. This is very helpfull to us.........thnq
View Tutorial          By: lavanya at 2012-03-17 05:43:12

9. GOOD FOR BIGGENERS
View Tutorial          By: naresh at 2012-08-04 11:19:03

10. FINALLY! A place that gives complete examples (wi
View Tutorial          By: bminton at 2013-03-19 00:15:55