Shell Scripting : 01 - Checking 2 String's If it's Empty or Equal
This is a Shell Script used to determine two Strings, if they are Empty or Equal.
Program Code:
#!/bin/bash echo " Enter String Number 1" read STR1 echo " Enter String Number 2" read STR2 if [ -z $STR1 ]; then echo " The String1 is Empty" else echo " The String1 is not Empty" fi if [ -n $STR2 ]; then echo " The String2 is not Empty" else echo " The String2 is Empty" fi if [ $STR1 = $STR2 ]; then echo " Both Strings is equal" else echo " Both String are not equal" fi
Post a Comment