From 34a247d95e45be413aab76fe9bc7a5ff6f4e10b2 Mon Sep 17 00:00:00 2001 From: Ziad Arafat Date: Tue, 21 Feb 2023 20:41:32 -0700 Subject: [PATCH] Added bash example --- PA002/main_bash.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 PA002/main_bash.sh diff --git a/PA002/main_bash.sh b/PA002/main_bash.sh new file mode 100644 index 0000000..aa716cf --- /dev/null +++ b/PA002/main_bash.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Prints a string when we don't have short-circuit evaluation. +function print_answer { + echo "We DO NOT have short-circuit evaluation!" + return 0 +} + +# Set A to false to see if it skips or not. +A=false + +# If they are both true print that they are both true else print +# A string we will use to see if we have short circuit eval. +if [[ $A == true && $(print_answer) ]]; then + echo "Both A and B are true" +else + echo "If you only see this then we DO have short circuit evaluation" +fi