Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 20 years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.
In Bash, when writing shell scripts then we need to use test operators to compare integer values, strings, and logical tests and file tests, etc. So here I am sharing the list of all bash shell operators in text and in picture format, which is downloadable.
Bash Shell Test Operators Cheat Sheet
Integer Comparisons
Function
-gt
Greater than
-lt
Less than
-ge
Greater than or equal to
-le
Less than or equal to
-eq
Equal to
-ne
Not equal to
String Comparisons
Functions
-z
Test for empty string
=
Test for equality of strings
!=
Test for inequality of strings
Logical Operators
Function
-a
Logical AND
-o
Logical OR
!
Logical NOT
File Test Operators
Function
-f
File exists and is a regular file
-s
File is not empty
-r
File is readable
-w
File can be written to and modified
-x
File is executable
-d
Filename is a directory name
Download the Bash Shell Test Operators Cheat Sheet in Picture format: