You are viewing a single comment's thread. Return to all comments →
#!/bin/bash read CHAR [ ${#CHAR} -eq 1 ] && [ $CHAR == 'Y' ] || [ $CHAR == 'y' ] && echo "YES" && exit 0 [ ${#CHAR} -eq 1 ] && [ $CHAR == 'N' ] || [ $CHAR == 'n' ] && echo "NO" && exit 0
EXPLANATION : : we are reading the char, :next if the char == length 1 we pass that to check if it is y,Y,n,N if it is anyone of it we print and exit
Seems like cookies are disabled on this browser, please enable them to open this website
Getting started with conditionals
You are viewing a single comment's thread. Return to all comments →
Easy solution:
EXPLANATION : : we are reading the char, :next if the char == length 1 we pass that to check if it is y,Y,n,N if it is anyone of it we print and exit