3

problem with seq

view full story
linux-howto

http://www.linuxquestions.org – Hello everybody!!!!! I want to sort an array using the selection sort technique... I wrote the following code Code: #this program is to sort a given array using selction sort technique #create an array of first arr=(2 75 46 31 24 988 225 ) #print the unsorted array first clear arrLen=`expr ${#arr[*]} - 1`        #holds the length of the array # this is the first for loop for i in `seq 0 $arrLen`   do       min=$i       #this is the second loop       for j in `seq `expr $i + 1` $arr_len`       do           if test ${arr[$min]} -gt ${arr[$j]}              then                 min=$j             fi       done       #swap among the minimum and second minimum position       temp=${arr[$min]}       arr[$min]=${arr[$i]}       arr[$i]=temp;   done #next print the sorted array echo ${arr[@]} but the problem is when I execute it, the following message is displayed Code: [lemon@localhost Shell Scripts]$ sh selection_sort.sh seq: missing operand Try `seq --help' for more information. selection_sort.sh: line 17: +: syntax error: operand expected (error token is "+") 2 75 46 31 24 988 225 I don't understand what the problem is... Can anybody please figure it out???? (HowTos)