From 8995643d533d4312fc081eeb96229e14de854613 Mon Sep 17 00:00:00 2001 From: miguel Date: Wed, 28 Dec 2022 15:39:02 +0000 Subject: [PATCH] feat(left): add subject, test and solution for the exercise --- sh/tests/left/facts | 21 +++++++++++++++++++++ sh/tests/left_test.sh | 30 ++++++++++++++++++++++++++++++ sh/tests/solutions/left.sh | 1 + subjects/devops/left/README.md | 29 +++++++++++++++++++++++++++++ subjects/devops/left/facts | 23 +++++++++++++++++++++++ 5 files changed, 104 insertions(+) create mode 100644 sh/tests/left/facts create mode 100755 sh/tests/left_test.sh create mode 100755 sh/tests/solutions/left.sh create mode 100644 subjects/devops/left/README.md create mode 100644 subjects/devops/left/facts diff --git a/sh/tests/left/facts b/sh/tests/left/facts new file mode 100644 index 00000000..06e5ca68 --- /dev/null +++ b/sh/tests/left/facts @@ -0,0 +1,21 @@ +10 random facts + +- Avocados are a fruit, not a vegetable. They're technically considered a single-seeded berry, believe it or not. + +- The Eiffel Tower can be 15 cm taller during the summer, due to thermal expansion meaning the iron heats up, the particles gain kinetic energy and take up more space. + +- Trypophobia is the fear of closely-packed holes. Or more specifically, "an aversion to the sight of irregular patterns or clusters of small holes or bumps." No crumpets for them, then. + +- Australia is wider than the moon. The moon sits at 3400km in diameter, while Australia’s diameter from east to west is almost 4000km. + +- 'Mellifluous' is a sound that is pleasingly smooth and musical to hear. + +- The Spice Girls were originally a band called Touch. "When we first started [with the name Touch], we were pretty bland," Mel C told The Guardian in 2018. "We felt like we had to fit into a mould." + +- Human teeth are the only part of the body that cannot heal themselves. Teeth are coated in enamel which is not a living tissue. + +- It's illegal to own just one guinea pig in Switzerland. It's considered animal abuse because they're social beings and get lonely. + +- The Ancient Romans used to drop a piece of toast into their wine for good health - hence why we 'raise a toast'. + +- The heart of a shrimp is located in its head. They also have an open circulatory system, which means they have no arteries and their organs float directly in blood. diff --git a/sh/tests/left_test.sh b/sh/tests/left_test.sh new file mode 100755 index 00000000..1b95fe00 --- /dev/null +++ b/sh/tests/left_test.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# Unofficial Bash Strict Mode +set -euo pipefail +IFS=' +' +script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) + +FILENAME="../student/left.sh" +cd left + +# True if FILE exists and is a regular file +if [ -f ${FILENAME} ]; then + # FILE exists and it's not empty + if [ -s ${FILENAME} ]; then + if [[ $(cat $FILENAME | grep echo | wc -l) -ne 0 ]]; then + echo "echo is not allowed in this exercise!" + exit 1 + submitted=$(bash $FILENAME) + expected=$(bash ../solutions/left.sh) + diff <(echo "$submitted") <(echo "$expected") + fi + else + echo "The file exist but is empty" + exit 1 + fi +else + echo "File does not exist" + exit 1 +fi diff --git a/sh/tests/solutions/left.sh b/sh/tests/solutions/left.sh new file mode 100755 index 00000000..456d10ef --- /dev/null +++ b/sh/tests/solutions/left.sh @@ -0,0 +1 @@ +wc -l You have to use Man or Google to know more about commands flags, in order to solve this exercise! +> Google and Man will be your friends! diff --git a/subjects/devops/left/facts b/subjects/devops/left/facts new file mode 100644 index 00000000..e065ac1f --- /dev/null +++ b/subjects/devops/left/facts @@ -0,0 +1,23 @@ +10 random facts + +- Avocados are a fruit, not a vegetable. They're technically considered a single-seeded berry, believe it or not. + +- The Eiffel Tower can be 15 cm taller during the summer, due to thermal expansion meaning the iron heats up, the particles gain kinetic energy and take up more space. + +- Trypophobia is the fear of closely-packed holes. Or more specifically, "an aversion to the sight of irregular patterns or clusters of small holes or bumps." No crumpets for them, then. + +- Australia is wider than the moon. The moon sits at 3400km in diameter, while Australia’s diameter from east to west is almost 4000km. + +- 'Mellifluous' is a sound that is pleasingly smooth and musical to hear. + +EOF + +- The Spice Girls were originally a band called Touch. "When we first started [with the name Touch], we were pretty bland," Mel C told The Guardian in 2018. "We felt like we had to fit into a mould." + +- Human teeth are the only part of the body that cannot heal themselves. Teeth are coated in enamel which is not a living tissue. + +- It's illegal to own just one guinea pig in Switzerland. It's considered animal abuse because they're social beings and get lonely. + +- The Ancient Romans used to drop a piece of toast into their wine for good health - hence why we 'raise a toast'. + +- The heart of a shrimp is located in its head. They also have an open circulatory system, which means they have no arteries and their organs float directly in blood.