Introduction
In this challenge, we will learn how to use the OR logic in the if statement of Bash.
In this challenge, we will learn how to use the OR logic in the if statement of Bash.
Create a Bash script named ~/project/if_with_OR.sh
that takes a number input from the user. If the value is equal to 15 or 45, then the output will be "You won the game". Otherwise, the output will be "You lost the game".
To run the script, use the following command:
bash if_with_OR.sh
Output:
Enter any number
15
You won the game
In this challenge, we learned how to use the OR logic in the if statement of Bash. We created a Bash script that takes a number input from the user and checks if it is equal to 15 or 45. If it is, then the output is "You won the game". Otherwise, the output is "You lost the game".