360 Secure SkillHub
360 安全技能中心

Test Tool

该 Skill 以命令行形式接收条件表达式,对文件属性、字符串相等性与数值大小进行比较,返回退出状态 0(真)或 1(假)。材料给出 -f、-d、-z、-eq、=、-gt 等常见测试用法示例,实现文件位于 scripts/test.py。

dinghaibin
dinghaibin
热度 30.72
最近更新 2026-05-11 17:47:34
分类:开发依赖:代码执行 / 读写文件应用场景:自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add test-tool
Metadata
name
test-tool
description
Evaluate conditional expressions for file testing, string comparison, and arithmetic checks. Use for shell script conditionals.

Test - Condition Evaluator

Evaluate expressions and return exit status 0 (true) or 1 (false). Used for file attribute testing, string comparison, and numeric checks in scripts.

Usage

test-tool <expression>

Common Tests

  • -f file: True if file exists
  • -d dir: True if directory exists
  • -z str: True if string is empty
  • n1 -eq n2: True if numbers equal
  • s1 = s2: True if strings equal

Examples

test-tool -f /etc/passwd
test-tool -d /home/user
test-tool 5 -gt 3