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. ahmm I guess This is a VB6 program? or how can I g
View Tutorial          By: kelvin at 2011-02-27 14:07:44

2. thanks brother i hope this is most important for e
View Tutorial          By: manglesh upadhyay at 2012-09-26 04:40:41

3. Thank you... Helpful :)
View Tutorial          By: Soopy at 2015-03-31 06:24:57

4. hi,
can you tell me how to run the code to

View Tutorial          By: raghu at 2008-12-26 03:15:52

5. it is possible to write any synchronisation progra
View Tutorial          By: shashi kant mishra at 2013-10-14 02:54:25

6. Hello, I have executed the above code and it works
View Tutorial          By: Sana at 2010-02-01 03:50:18

7. How to use it
View Tutorial          By: Ted at 2011-12-23 07:23:20

8. I writing a main class in the eclipse IDE and call
View Tutorial          By: adam lim at 2013-03-11 04:13:51

9. hi sir
im a student of aitm im doing speec

View Tutorial          By: sinan ahmed at 2015-02-09 05:45:49

10. i can saved when i run the program...
but w

View Tutorial          By: kathleen ashley at 2010-08-02 05:22:46