There is a function provided by bash called test which returns a true or false value depending on the result of the tested expression.
www.comptechdoc.org