Getting started with conditionals

Sort by

recency

|

341 Discussions

|

  • + 0 comments

    !/bin/bash

    read chr if [ "chr" = "y" ]; then echo "YES" elif [ "chr" = "n" ]; then echo "NO" fi

  • + 0 comments

    read input

    if [[ $input =~ [Yy] ]]; then echo "YES" else echo "NO" fi

  • + 0 comments

    Practice using real-life examples to grasp how conditionals influence behavior in different scenarios. Gold 365.site

  • + 0 comments

    read -p "Ingresa Y/N: " c

    if [[ ]]; then echo "NO"s else echo "YES" fi

  • + 0 comments
    read c
    if [ $c = 'Y' -o $c = 'y' ]
    then
        echo "YES"
    else
        echo "NO"
    fi