test
Evaluate file properties like existence, type, and permissions, returning JSON boolean for conditional scripting.
Instructions
Evaluate file predicates (exists, is_file, is_dir, is_executable, is_symlink, is_readable, is_writable) and return structured JSON with the boolean result. Read-only, no side effects. Returns JSON indicating test result and exit code (0 for true, 1 for false). Use for conditional branching based on file properties in scripts. Not for detailed file inspection — use 'stat' for full metadata. See also 'stat', '['.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| directory | No | Path is a directory. | |
| empty | No | Path is an empty regular file. | |
| executable | No | Path is executable. | |
| exists | No | Path exists. This is the default predicate. | |
| exit_code | No | Return exit code 1 when predicates do not match. | |
| file | No | Path is a regular file. | |
| non_empty | No | Path is a non-empty regular file. | |
| path | Yes | Path to test. | |
| readable | No | Path is readable. | |
| symlink | No | Path is a symbolic link. | |
| writable | No | Path is writable. |