We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Getting started with conditionals
Getting started with conditionals
Sort by
recency
|
333 Discussions
|
Please Login in order to post a comment
read input
if [[ input == 'y' ]]; then echo "YES" elif [[ input == 'n' ]];then echo "NO" fi
read -p "y" char
if [ "char" == "y" ]; then echo "YES" elif [ "char" == "n" ]; then echo "NO" fi
I used case statement ->
read input case $input in [yY]) echo "YES" ;; [nN]) echo "NO" ;; esac