CmdID

CmdID / Commands

test

Return true or false by performing tests. toybox

On Linux 1 Sigma rule name it

Opens CmdID with your command. It is read in your browser and sent nowhere.

Linux

from the toybox, 0BSD

Return true or false by performing tests. No arguments is false, one argument is true if not empty string. --- Tests with a single argument (after the option): --- Tests with one argument on each side of an operator:

test [-bcdefghkLprSsuwx PATH] [-nz STRING] [-t FD] [X ?? Y]
Show 28 options
-b PATHblock device
-f PATHregular file
-p PATHfifo
-u PATHsetuid bit
-c PATHchar device
-g PATHsetgid
-r PATHreadable
-w PATHwritable
-d PATHdirectory
-h PATHsymlink
-S PATHsocket
-x PATHexecutable
-e PATHexists
-L PATHsymlink
-s PATHnonzero size
-k PATHsticky bit
-n STRINGnonzero size
-z STRINGzero size
-t FDa TTY = are identical != differ =~ string matches regex < first is lower > first higher
-eqequal
-gtfirst > second
-ltfirst < second
-nenot equal
-gefirst >= second
-lefirst <= second
-otOlder mtime
-ntNewer mtime
-efsame dev/inode ! EXPR not (swap true/false) EXPR -a EXPR and (are both true) ( EXPR ) evaluate this first EXPR -o EXPR or (is either true)

Several platforms

from tldr-pages, CC BY 4.0

Check file types and compare values. Returns 0 if the condition evaluates to true, 1 if it evaluates to false.

Test if a given variable is equal to a given string

test "$MY_VAR" = "/bin/zsh"Identify

Test if a given variable is empty (zero length)

test -z "$GIT_BRANCH"Identify
-zzero size toybox

Test if a file exists

test -f "path/to/file"Identify
-fregular file toybox

Test if a directory does not exist

test ! -d "path/to/directory"Identify
-ddirectory toybox

If A is true, then do B, or C in the case of an error (notice that C may run even if A fails)

test condition && echo "true" || echo "false"Identify

Use test in a conditional statement

if test -f "path/to/file"; then echo "File exists"; else echo "File does not exist"; fiIdentify
-fregular file toybox

Display help

help testIdentify

What detects it

Sigma process creation rules that name test