aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-003/abigail/README.md1
-rw-r--r--challenge-003/abigail/bash/ch-1.sh21
2 files changed, 22 insertions, 0 deletions
diff --git a/challenge-003/abigail/README.md b/challenge-003/abigail/README.md
index d80777132e..68680ae56f 100644
--- a/challenge-003/abigail/README.md
+++ b/challenge-003/abigail/README.md
@@ -9,6 +9,7 @@ numbers. For more information, please check this
### Solutions
* [AWK](awk/ch-1.awk)
+* [Bash](bash/ch-1.sh)
* [C](c/ch-1.c)
* [Perl](perl/ch-1.pl)
diff --git a/challenge-003/abigail/bash/ch-1.sh b/challenge-003/abigail/bash/ch-1.sh
new file mode 100644
index 0000000000..76029e700b
--- /dev/null
+++ b/challenge-003/abigail/bash/ch-1.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#
+# See ../README.md
+#
+
+#
+# Run as: bash ch-1.sh < input-file
+#
+
+set -f
+
+while read max
+do for ((base2 = 1; $base2 <= $max; base2 *= 2))
+ do for ((base3 = $base2; $base3 <= $max; base3 *= 3))
+ do for ((base5 = $base3; $base5 <= $max; base5 *= 5))
+ do echo $base5
+ done
+ done
+ done
+done