All pastes #955568 Raw Edit

Mine

public text v1 · immutable
#955568 ·published 2008-03-24 18:47 UTC
rendered paste body
#!/bin/bash


myFileHodn="hodnoceni.txt"
myFileStud="students.txt"


for (( i=1 ; i <= $# ; i++ )) ;do
     eval arg='$'$i
     if ["$arg" = "-h"] ;then i=`expr $i + 1`; eval arg='$'$i ; myFileHodn=$arg
     elif ["$arg" = "-s"] ;then i=`expr $i + 1`; eval arg='$'$i ; myFileStud=$arg
     else echo "$arg je neznamy argument." ; exit
     fi
     done

a='RETAZEC_KTORY_NIKTO_NIKDY_NEPOUZIJE'

for myFileHodn in `dir` 
do 

echo testujeme

  echo '' > xxxtemp.txt
  cat $myFileHodn | while myLineHodn=`line`
  do

echo testujeme2

     temphodn="$allFile"
     allFile="$temphodn $myLineHodn" 
     echo "$allFile" > $myFileHodn"

     output=`echo $myLineHodn | sed -e "s/ /$a/mg"`
     output=`echo $output | sed -e 's/;/ /mg'`

     counter=0
     for word in $output ; do
	eval xhodn_$counter='`echo $word | sed -e "s/$a/ /mg"`'
	let counter++  # increasing counter
     done




     for myFileStud #in 'dir'
     do

       cat &myFileStud | while myLineStud=`line`
       do

         tempstud="$allFile"
         allFile="$tempstud $myLineStud"
         echo "$allFile" > "$myFileStud"



         output=`echo $myLineHodn | sed -e "s/ /$a/mg"`
         output=`echo $output | sed -e 's/;/ /mg'`

         counter=0
         for word in $output ; do
	    eval xstud_$counter='`echo $word | sed -e "s/$a/ /mg"`'
	    let counter++  # increasing counter
         done


if [ "$xhodn_0" = "$xstud_1" ] ;then if [ "$xhodn_1" = "A" ] ;then xstud_2=$xhodn_1
                                   elif [ "$xhodn_1" = "a" ] ;then xstud_2=$xhodn_1
                                   elif [ "$xhodn_1" = "B" ] ;then xstud_3=$xhodn_1
                                   elif [ "$xhodn_1" = "b" ] ;then xstud_3=$xhodn_1
                                   elif [ "$xhodn_1" = "C" ] ;then xstud_4=$xhodn_1
                                   elif [ "$xhodn_1" = "c" ] ;then xstud_4=$xhodn_1
                                   elif [ "$xhodn_1" = "E" ] ;then xstud_5=$xhodn_1
                                   elif [ "$xhodn_1" = "e" ] ;then xstud_5=$xhodn_1
fi


xstud_6=`expr $xstud_2 + $xstud_3 + $xstud_4 + $xstud_5`

echo '$xstud_0;$xstud_1;$xstud_2;$xstud_3;$xstud_4;$xstud_5;$xstud_6' >> xxxtemp.txt
rm myFileStud
mv xxxtemp.txt myFileStud

done
done

done 
done