diff --git a/src/rhcsa.md b/src/rhcsa.md index e9f696a..057ff8d 100644 --- a/src/rhcsa.md +++ b/src/rhcsa.md @@ -387,4 +387,20 @@ until [ $i -gt 10 ]; do echo $i i=$((i+1)) done +``` + +### Example script to check a user's age +```bash +#!/bin/bash +echo "Please provide me your age: " + +read age + +if [ "$age" -le 17 ]; then + echo "You cannot enter bars or vote." +elif [ "$age" -ge 18 ] && [ "$age" -le 20 ]; then + echo "You can vote but not enter bars." +else + echo "You are old enough to vote and enter bars." +fi ``` \ No newline at end of file