← 返回
未分类 中文

Value & Environment Validator

Value validation and environment detection tool for Shell scripts. Validates input types (integers, floats, IPs), compares file ages, detects runtime environ...
用于Shell脚本的值校验与环境检测工具。可验证输入类型(整数、浮点数、IP),比较文件时间戳,检测运行时环境...
lunrenyi
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 308
下载
💾 0
安装
1
版本
#latest

概述

x is - Value & Environment Validation

x is is x-cmd's value validation tool for checking if values or environment states meet specific criteria. Supports batch checking multiple values, ideal for robust Shell scripting.

Prerequisites

  1. Load x-cmd before use:

```bash

. ~/.x-cmd.root/X

```

Core Usage

  • Type Check: x is int 42 100 -5 / x is float 3.14
  • Range Check: x is minmax 1 100 50 75
  • Compare: x is eq "a" "a" / x is within "ok" pending success
  • IP Check: x is ip 192.168.1.1
  • File Age: x is newest target src/.c / x is oldest cache.txt /tmp/.tmp
  • Variable Check: x is unset VAR1 VAR2
  • Environment Detection: x is interactive / x is wsl / x is termux

Subcommands

Type

CommandDescription
----------------------
intInteger check, batch supported
floatFloat check (must contain decimal point)
positivePositive integer (≥0)
negativeNegative integer (<0)
minmaxRange check [MIN,MAX]

Compare

CommandDescription
----------------------
eqMultiple values equal
withinFirst value in candidate list
inColon-separated list member check
in-Dash-separated list
in_Underscore-separated list
in/Slash-separated list
`in\`Pipe-separated list

Network

CommandDescription
----------------------
ipIPv4 address check

File

CommandDescription
----------------------
newestFile newer than others (glob supported)
oldestFile older than others (glob supported)

Variable

CommandDescription
----------------------
unsetVariable is unset

Environment

CommandDescription
----------------------
interactiveInteractive session
interactive_ttystdin is interactive TTY
interactiveshellShell is interactive
replREPL mode
stdout2ttystdout outputs to TTY
wslWSL environment
cygwinCygwin environment
msysMSYS/MinGW environment
gitbashGit Bash environment
termuxTermux environment
ishiSH environment

Suitability

CommandDescription
----------------------
suitable_pkgSuitable for package installation
suitable_advise_envSuitable for advise feature
suitable_advise_replSuitable for advise REPL

Practical Examples

Batch Type Validation

x is int 1 2 3 4 5 && echo "All integers"
x is float 3.14 -2.5 .5 && echo "All floats"

Environment Conditional Branch

x is interactive && echo "Interactive session" || echo "Script mode"
x is wsl && echo "WSL environment" || echo "Not WSL"
x is termux && echo "Termux environment"

File Status Check

x is newest build.tar.gz src/*.c lib/*.h || echo "Rebuild needed"

Variable Cleanup Verification

x is unset TEMP_VAR1 TEMP_VAR2 && echo "Temp variables cleaned"

Script Pre-flight Check

x is suitable_pkg || { echo "Environment not suitable"; exit 1; }

Design Principles

  • Batch First: Check multiple values at once, all must pass
  • Exit Code Semantics: 0 = success, 1 = failure, perfect for &&/|| chains
  • Silent: Validation tool outputs nothing, only exit code indicates result

Get Help

x is --help

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 11:43 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

RFC Document Assistant

lunrenyi
RFC文档查询工具,用于查询互联网协议标准。当用户需要查找、搜索RFC文档时使用此技能。
★ 2 📥 530
developer-tools

Mirror Source Manager

lunrenyi
x-mirror 是一款全面的多包管理器镜像源管理工具。当用户需要配置、切换或查询镜像源时,请使用此技能。
★ 1 📥 531
developer-tools

Archive/Compression Assistant

lunrenyi
处理压缩归档任务,支持压缩、解压、打包、列目录及查看文件。支持 zip、tar、gz 等格式。
★ 0 📥 545