For more detailed Tutorial visit - https://goo.gl/vn9xIb

Conditionals let us decide whether to perform an action or not, this decision is taken by evaluating an expression.

Expressions
An expression can be: String comparison, Numeric comparison, File operators and Logical operators and it is represented by [expression]:
String Comparisons:
---------------------------------
= compare if two strings are equal
!= compare if two strings are not equal
-n evaluate if string length is greater than zero
-z evaluate if string length is equal to zero

Examples:
[ s1 = s2 ] (true if s1 same as s2, else false)
[ s1 != s2 ] (true if s1 not same as s2, else false)
[ s1 ] (true if s1 is not empty, else false)
[ -n s1 ] (true if s1 has a length greater then 0, else false)
[ -z s2 ] (true if s2 has a length of 0, otherwise false)

Number Comparisons:
------------------------------------
-eq compare if two numbers are equal
-ge compare if one number is greater than or equal to a number
-le compare if one number is less than or equal to a number
-ne compare if two numbers are not equal
-gt compare if one number is greater than another number
-lt compare if one number is less than another number

Examples:
[ n1 -eq n2 ] (true if n1 same as n2, else false)
[ n1 -ge n2 ] (true if n1greater then or equal to n2, else false)
[ n1 -le n2 ] (true if n1 less then or equal to n2, else false)
[ n1 -ne n2 ] (true if n1 is not same as n2, else false)
[ n1 -gt n2 ] (true if n1 greater then n2, else false)
[ n1 -lt n2 ] (true if n1 less then n2, else false)

Top Online Courses From ProgrammingKnowledge
Python Programming Course Programming Course Shell Scripting Course Command Line Tutorials Programming Course Programming Course Programming Course Development Course Programming Course Programming Course Programming Course Course For Developers and DevOps Programming Tutorial Course Responsive Web Design Tutorial Tutorial Course C++ GUI Tutorial For Beginners Online Courses to learn
Get 2 FREE Months of Unlimited Classes from skillshare - https://skillshare.eqcm.net/r1KEj
Data Science - | Learning - |
Artificial Intelligence - | Stack E-Degree Program - | E-degree - | Analytics with R - | Certification Training - | in Java - | Learning With TensorFlow - | 8 - Complete Essential Guide - Android Development Masterclass - iOS Programming Building Advance Projects - Follow
My Website - http://www.codebind.com

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!