From 1340f41d195abe258ff1664bf0e7b4e5f1dd8990 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 19 Jul 2021 15:48:02 +0200 Subject: Solutions in 17 languages for week 122, part 1. --- challenge-122/abigail/bash/ch-1.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 challenge-122/abigail/bash/ch-1.sh (limited to 'challenge-122/abigail/bash') diff --git a/challenge-122/abigail/bash/ch-1.sh b/challenge-122/abigail/bash/ch-1.sh new file mode 100644 index 0000000000..29d3a79f9d --- /dev/null +++ b/challenge-122/abigail/bash/ch-1.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-1.sh < input-file +# + +while read n; do echo $(((s += n) / ++ c)); done -- cgit From 62818508c81af33a19e400cce9145e681920eb82 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 24 Jul 2021 23:11:35 +0200 Subject: Solutions for week 122, part 2, in 8 different languages. --- challenge-122/abigail/bash/ch-2.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 challenge-122/abigail/bash/ch-2.sh (limited to 'challenge-122/abigail/bash') diff --git a/challenge-122/abigail/bash/ch-2.sh b/challenge-122/abigail/bash/ch-2.sh new file mode 100644 index 0000000000..d523f918bf --- /dev/null +++ b/challenge-122/abigail/bash/ch-2.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# +# See ../README.md +# + +# +# Run as: bash ch-2.sh < input-file +# + +set -f + +declare scores +l=$'\n' +scores[2]=$l + +read n + +for ((i = 3; i < n + 3; i ++)) +do for ((j = 1; j <= 3; j ++)) + do scores[$i]=${scores[$i]}${scores[$((i - j))]//$l/$l$j } + done +done + +echo "${scores[$((n + 2))]/$l/}" -- cgit