sd

  #!/bin/bash


# Example 1: Simple if-else condition

read -p "Enter a number: " num


if [ $num -gt 0 ]; then

  echo "The number is positive."

else

  echo "The number is non-positive."

fi


# Example 2: If-else condition with multiple conditions

read -p "Enter your age: " age


if [ $age -lt 18 ]; then

  echo "You are a minor."

elif [ $age -ge 18 ] && [ $age -lt 65 ]; then

  echo "You are an adult."

else

  echo "You are a senior citizen."

fi


Comments