第 43 行:语法错误:意外的文件结尾
编译 unix 脚本代码时,我在第 43 行遇到语法错误。此代码用于搜索文本文件的文件夹并匹配 input.txt 中的任何单词。 不过代码还没有完成
#!/bin/bash
findkeyword () {
file="$1"
keyword="$2"
value="$3"
int count = 0
cat $file | awk '{
while read line
do
for (ii=1;ii<=NF;ii++) {
if ($ii == $keyword)
count++
fi
}
done
}'
echo "Profile: " $file
scorefile $value $count
scorefile () {
value="$1"
count="$2"
echo "Score: " $value*$count
}
cat input.txt | awk '{
while read line
do
keyword=$1
value=$2
for xx in `ls submissions/*`
do
filename=$xx
findkeyword $filename $keyword $value
done
done
}'
I am getting a syntax error on line 43 when compiling the unix script code. This code is to search through a folder of textfile and match any word from the input.txt.
code still hasn't finish yet though
#!/bin/bash
findkeyword () {
file="$1"
keyword="$2"
value="$3"
int count = 0
cat $file | awk '{
while read line
do
for (ii=1;ii<=NF;ii++) {
if ($ii == $keyword)
count++
fi
}
done
}'
echo "Profile: " $file
scorefile $value $count
scorefile () {
value="$1"
count="$2"
echo "Score: " $value*$count
}
cat input.txt | awk '{
while read line
do
keyword=$1
value=$2
for xx in `ls submissions/*`
do
filename=$xx
findkeyword $filename $keyword $value
done
done
}'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)