Bash Not Equal String Code Example


Example 1: greater than in script

-eq is equal to  if [ "$a" -eq "$b" ]  -ne is not equal to  if [ "$a" -ne "$b" ]  -gt is greater than  if [ "$a" -gt "$b" ]  -ge is greater than or equal to  if [ "$a" -ge "$b" ]  -lt is less than  if [ "$a" -lt "$b" ]  -le is less than or equal to  if [ "$a" -le "$b" ]

Example 2: test string equality bash

strval1="Ubuntu" strval2="Windows"  #Check equality two string variables  if [ $strval1 == $strval2 ]; then   echo "Strings are equal" else   echo "Strings are not equal" fi  #Check equality of a variable with a string value  if [ $strval1 == "Ubuntu" ]; then   echo "Linux operating system" else   echo "Windows operating system" fi

Comments

Popular posts from this blog

Chemistry - Bond Angles In NH3 And NCl3

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Change The Font Size Of Visual Studio Solution Explorer