If Condition FlAGS

Condition Flag

Description

-e

True if the file exists.

-f

True if the file exists and is a regular file.

-d

True if the file exists and is a directory.

-r

True if the file exists and is readable.

-w

True if the file exists and is writable.

-x

True if the file exists and is executable.

-s

True if the file exists and is not empty (has a size greater than 0).

-L

True if the file exists and is a symbolic link.

-z

True if the string is empty.

-n

True if the string is not empty.

-eq

True if two numbers are equal.

-ne

True if two numbers are not equal.

-lt

True if one number is less than another.

-le

True if one number is less than or equal to another.

-gt

True if one number is greater than another.

-ge

True if one number is greater than or equal to another.

==

True if two strings are equal.

!=

True if two strings are not equal.

!

Negates the condition, i.e., true if the condition is false.

-o

Logical OR between two conditions (deprecated, prefer `

-a

Logical AND between two conditions (deprecated, prefer &&).

[[ ... ]]

Advanced conditional expressions, allowing pattern matching and logical operators.

 

  

Comments

Popular posts from this blog

AWK : Commands

CURL Commands

$$$$ Symbols in shell scripting