When I run this peace of code, which check some conditions on the fields of sent.txt and recieved.txt in the folder of each worker and prints his name, if the conditions are true:
function to_print_suspicious {
while read name; do
files=("sent.txt received.txt")
for file in $files;do
if ((`cat "$name/$file"|cut -f1`==0)) && ((`cat "$name/$file"|cut -f5|grep -c -w $1`>0 )) || ((`cat "$name/$file"|cut -f4|grep -c -w $1` > 0)) ; then
echo $name
fi
done
done | uniq } ls | to_print_suspicious $1
I get a long list of error:
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: scott@gmail.com
dan@animation.com
erin@gmail.com==0: syntax error: invalid arithmetic operator (error token is "@gmail.com
dan@animation.com
erin@gmail.com==0")
amanda
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: 0
1==0: syntax error in expression (error token is "1==0")
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: scott@gmail.com
dan@animation.com
erin@fancystudios.com==0: syntax error: invalid arithmetic operator (error token is "@gmail.com
dan@animation.com
erin@fancystudios.com==0")
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: 0
1==0: syntax error in expression (error token is "1==0")
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: dan@animation.com
scott@gmail.com
erin@gmail.com==0: syntax error: invalid arithmetic operator (error token is "@animation.com
scott@gmail.com
erin@gmail.com==0")
jennifer
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: 0
1==0: syntax error in expression (error token is "1==0")
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: scott@gmail.com
dan@animation.com
erin@gmail.com==0: syntax error: invalid arithmetic operator (error token is "@gmail.com
dan@animation.com
erin@gmail.com==0")
melissa
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: 0
1==0: syntax error in expression (error token is "1==0")
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: scott@gmail.com
dan@animation.com
erin@gmail.com==0: syntax error: invalid arithmetic operator (error token is "@gmail.com
dan@animation.com
erin@gmail.com==0")
michael
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: 0
1==0: syntax error in expression (error token is "1==0")
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: dan@fancystudios.com
scott@gmail.com
kelly@beststudios.com
erin@animation.com==0: syntax error: invalid arithmetic operator (error token is "@fancystudios.com
scott@gmail.com
kelly@beststudios.com
erin@animation.com==0")
/homet2/s3218517/mtm/ex1/scripts/sc3: line 6: ((: 0
0==0: syntax error in expression (error token is "0==0")
I think the problem is the use of && and || operators here, how can I fix this ?
Aucun commentaire:
Enregistrer un commentaire