我有一个有趣的问题,我似乎无法弄清楚。
我有一个提取配置信息并将其重定向到文件的基本脚本:
cat /etc/something > 1
cat /etc/something-else > 2
一旦我的数据收集完成,我就会运行一个“解析器”来显示有关检查的信息:
#58
id="RHEL-06-000001"
ruleid="The system must require passwords to contain at least one special character."
if grep -G [a-z] 1; then
ocredit=`cat 1 | grep -v "^#" | awk '{print $2}'`
if [ "$ocredit" -le -1 ]; then
result="Not A Finding"
todo="None"
else
result="Open"
todo="The current value is $ocredit. This is less than the minimum requirement of - 1."
fi
else
result="Open"
todo="The option is not configured"
fi
echo "$id, $ruleid, $result, $todo" >> Findings.csv
#59
id="RHEL-06-000002"
ruleid="The system must require passwords to contain at least one lowercase alphabetic character."
if grep -G [a-z] 2; then
lcredit=`cat 2 | awk -F"=" '{print $2}'`
if [ "$lcredit" -le -1 ]; then
result="Not A Finding"
todo="None"
else
result="Open"
todo="The current value is $lcredit. This is less than the minimum requirement of -1."
fi
else
result="Open"
todo="The system is not configured to require at least one lowercase alphabetical charatcer in passwords."
echo "$id, $ruleid, $result, $todo" >> Findings.csv
或与之相近的东西。
我进行了大约 250 次此类检查,但我的代码运行前 58 次,然后停止并且不再将内容重定向到 checks.csv。
在脚本过早完成后,我确实收到了一个错误,说明
./checker.sh: line 2898: syntax error: unexpected end of file
这是我的文件的结尾,但我似乎无法弄清楚它是如何转义到脚本中的那个点的。
踢球者,这一切都在大约半小时前才起作用,它已经被难住了。
你能帮我吗?