Comparing Numbers

Sort by

recency

|

255 Discussions

|

  • + 0 comments

    read X read Y if [ Y ]; then echo "X is less than Y" elif [ Y ]; then echo "X is greater than Y" else echo "X is equal to Y" fi

  • + 0 comments

    read X read Y

    if [[ Y ]]; then echo "X is greater than Y" elif [[ Y ]]; then echo "X is less than Y" else echo "X is equal to Y" fi

  • + 0 comments

    !/bin/bash

    read x read y if((x > y)); then echo "X is greater than Y" elif ((x < y)); then echo "X is less than Y" else echo "X is equal to Y" fi

  • + 0 comments
    read X
    read Y
    
    if [ $X -gt $Y ]; then
        echo "X is greater than Y"
    elif [ $X -lt $Y ]; then
        echo "X is less than Y"
    else
        echo "X is equal to Y"
    fi
    
  • + 0 comments

    read X read Y if ((X < Y)) then echo "X is less than Y" elif ((X > Y)) then echo "X is greater than Y" else echo "X is equal to Y" fi