From 61cdc9a6e4731fc7064392bfaebaf9b014d6ae7c Mon Sep 17 00:00:00 2001 From: "G. A. Gama" <66579913+usrbinbrain@users.noreply.github.com> Date: Sun, 4 Dec 2022 17:20:34 -0300 Subject: [PATCH] Add(argument_check.md) Add argument check solution (#323) * Add(argument_check.md) Add argument check solution * Change(argument_check.md) Add objectives of script --- topics/shell/solutions/argument_check.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 topics/shell/solutions/argument_check.md diff --git a/topics/shell/solutions/argument_check.md b/topics/shell/solutions/argument_check.md new file mode 100644 index 0000000..55bf560 --- /dev/null +++ b/topics/shell/solutions/argument_check.md @@ -0,0 +1,17 @@ +## Argument Check + +### Objectives + +Note: assume the script is executed with an argument + +1. Write a script that will check if a given argument is the string "pizza" +2. If it's the string "pizza" print "with pineapple?" +3. If it's not the string "pizza" print "I want pizza!" + +### Solution + +``` +#!/usr/bin/env bash + +[[ ${1} == "pizza" ]] && echo "with pineapple?" || echo "I want pizza!" +```