aboutsummaryrefslogtreecommitdiff
path: root/entries/braxtonhall/wc/fib.sh
diff options
context:
space:
mode:
Diffstat (limited to 'entries/braxtonhall/wc/fib.sh')
-rw-r--r--entries/braxtonhall/wc/fib.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/entries/braxtonhall/wc/fib.sh b/entries/braxtonhall/wc/fib.sh
new file mode 100644
index 0000000..fc419b3
--- /dev/null
+++ b/entries/braxtonhall/wc/fib.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+function rec () {
+
+ if [ $2 == "0" ]; then
+ :
+ elif [ $2 == "1" ]; then
+ [ -f "$1/$2.fib" ] || echo "🥵" > "$1/$2.fib"
+ else
+ [ -d "$1/$2" ] || mkdir "$1/$2"
+ rec "$1/$2" $(($2 - 1))
+ rec "$1/$2" $(($2 - 2))
+ fi
+}
+
+if [[ $1 =~ ^[0-9]+$ ]]; then
+ rec $(pwd) $1
+ find $(pwd)/$1 -type f | wc -l
+else
+ echo "Please provide a natural number!"
+ exit 1
+fi