|
|
@ -19,7 +19,7 @@ check_command "id tom &>/dev/null && id jack &>/dev/null && grep hr /etc/group & |
|
|
|
check_command "[ -d /opt/myfile ] && [ -f /opt/myfile/hello.txt ] && [ -f /opt/world.txt ]" 3 |
|
|
|
check_command "[ -d /opt/myfile ] && [ -f /opt/myfile/hello.txt ] && [ -f /opt/world.txt ]" 3 |
|
|
|
|
|
|
|
|
|
|
|
# 4. 检查world.txt文件是否包含abcde字符串,且重复10行 |
|
|
|
# 4. 检查world.txt文件是否包含abcde字符串,且重复10行 |
|
|
|
check_command "grep -Fxq 'abcde' /opt/world.txt && [ \$(grep -c 'abcde' /opt/world.txt) -eq 10 ]" 4 |
|
|
|
check_command "grep -Fxq 'abcde' /opt/world.txt && [ \$(grep -c 'abcde' /opt/world.txt) -ge 10 ]" 4 |
|
|
|
|
|
|
|
|
|
|
|
# 5. 检查world.txt文件的属主是否为jack,属组是否为hr |
|
|
|
# 5. 检查world.txt文件的属主是否为jack,属组是否为hr |
|
|
|
check_command "[ \$(stat -c '%U' /opt/world.txt) = 'jack' ] && [ \$(stat -c '%G' /opt/world.txt) = 'hr' ]" 5 |
|
|
|
check_command "[ \$(stat -c '%U' /opt/world.txt) = 'jack' ] && [ \$(stat -c '%G' /opt/world.txt) = 'hr' ]" 5 |
|
|
|