test
test is a Linux command in the Shell & Scripting category, rated advanced difficulty. Evaluates conditional expressions. Used in shell scripts (if/while). The syntax is test expression 或 [ expression ]. Key options and parameters: expression — condition to test. It returns exit status 0 (true) or 1 (false). A practical example: test -f file.txt && echo "exists" [ "$name" = "Alice" ] && echo "Hello Alice" if [ -d "/path" ]; then echo "Directory exists"; fi A close relative is echo, which displays a line of text. Used in scripts for output. A close relative is printf, which formats and prints data (like C printf). More control than echo. A close relative is export, which sets or exports environment variables for child processes. More about this category: Linux shell and scripting commands — bash, echo, export, alias, and more. Work with the shell environment and scripts.