*Kind Note*: This was written with a sense of humor to allow visitors quickly discover code anomaly and suggests fixes but if it is not up to your mark, please close your browser tab instead of making unnecessary noise. Thanks You!
I am putting a damn small thing here regarding bash script for fun.
Here it goes: Need to create a bash script which asks for a word from user, say either “one”, “two” or “three” and then check in single if statement (no else if section) that if its not “one” or “two” or “three” then print Not OK otherwise print OK.
Further, here is a snippet, check and figure out why its not working as expected:
#!/bin/bash echo -n Enter a word: read myword if [[ $myword != "one" || $myword != "two" || $myword != "three" ]]; then echo Not OK else echo OK fi |
Please put your suggestion/solution script in comments.