Home » » Shell Scripting Tutorial For Beginners Viii - Logical 'And' Operator

Shell Scripting Tutorial For Beginners Viii - Logical 'And' Operator

#! /bin/bash  age=60  # for using And operator role && if [ "$age" -gt 18] && ["$age" -lt xxx ] then   echo "valid age"   else   echo "age non valid" fi  #  The -a selection provide # an choice chemical compound status test. if [ "$age" -gt eighteen -a "$age" -lt xxx ] then   echo "valid age"   else   echo "age non valid" fi  # if [[ $condition1 && $condition2 ]]    # Also works. if [[ "$age" -gt eighteen && "$age" -lt xxx ]] then   echo "valid age"   else   echo "age non valid" fi 

0 comments:

Post a Comment

Search

Blog Archive