The test command is used to check file types and compare values. Test is used in conditional execution. It is used for: File attributes comparisons.
Why test command is used in Unix?
Overview. The test command in Unix evaluates the expression parameter. In most recent shell implementations, it is a shell builtin, even though the external version still exists. … File-name substitution (globbing) causes the shell script to exit.
What is test command in bash?
test provides no output, but returns an exit status of 0 for “true” (test successful) and 1 for “false” (test failed). The test command is frequently used as part of a conditional expression. For instance, the following statement says, “If 4 is greater than 5, output yes, otherwise output no.”