脚本sc2在我自己运行时工作,但是当我尝试从另一个脚本运行它时会出现一些奇怪的错误。
#!/bin/bash
function print {
while read name; do
echo $1 $name
done
}
function find_suspect {
while read domain; do
echo $domain
sc2 $domain|print 1
sc3 money|print 2
sc3 new ideas|print 2
sc4 3|print 3
done
}
#main
find_suspect $* | sort -k1 | sort -sk2 | uniq -f1
done
问题出在sc2:
grep: Unmatched [ or [^
/homet2/s3218517/mtm/ex1/scripts/sc2: line 4: ((: >0: syntax error: operand expected (error token is ">0")
grep: Unmatched [ or [^
/homet2/s3218517/mtm/ex1/scripts/sc2: line 4: ((: >0: syntax error: operand expected (error token is ">0")
grep: Unmatched [ or [^
/homet2/s3218517/mtm/ex1/scripts/sc2: line 4: ((: >0: syntax error: operand expected (error token is ">0")
grep: Unmatched [ or [^
/homet2/s3218517/mtm/ex1/scripts/sc2: line 4: ((: >0: syntax error: operand expected (error token is ">0")
grep: Unmatched [ or [^
/homet2/s3218517/mtm/ex1/scripts/sc2: line 4: ((: >0: syntax error: operand expected (error token is ">0")
grep: Unmatched [ or [^
/homet2/s3218517/mtm/ex1/scripts/sc2: line 4: ((: >0: syntax error: operand expected (error token is ">0")
这是sc2:
#!/bin/bash
ls | while read file; do
if ((`sc1 $file $LAST_SENT_EMAILS_TO_CONSIDER | cut -d"@" -f2 | grep "$1" -c -w`>0)); then
echo $file
fi
done | sort
收到并发送: 收到:
0 kevin@animation.com 2015-11-30 09:14 Notes from the meeting
1 shannon@animation.com 2015-11-29 08:21 Some new ideas for movies
发送:
scott@gmail.com 2015-11-30 23:14 Thanks for the awesome present!
dan@animation.com 2015-11-29 22:15 Some cool reviews
erin@gmail.com 2015-11-29 09:35 Vacation this summer
sc2打印所有工作人员的姓名,这些工作人员邮寄给或来自给定的域名(作为参数)。
在sc5中,我获得了很少的域名,并且想要为它们打印所有人,所有工作者的名字(数字1除外)作为sc2使用while循环。实现有什么问题?