aboutsummaryrefslogtreecommitdiff
path: root/entries/braxtonhall/wc
diff options
context:
space:
mode:
authorfunemy2022-10-25 07:14:52 +0000
committerfunemy2022-10-25 07:14:52 +0000
commit998ef837b43203319397f191036a97a5adc42220 (patch)
tree920558bd60d282c663fd2da1cd4144cac1849a1d /entries/braxtonhall/wc
parentfdac6c60e115297a58f5b81da0c4b7f18ac758f2 (diff)
parentce7544a6db594f7d3dfad0d7dc65d01515e57ad6 (diff)
Merge branch 'main' of github.com:braxtonhall/fib
Diffstat (limited to 'entries/braxtonhall/wc')
-rw-r--r--entries/braxtonhall/wc/.gitignore1
-rw-r--r--entries/braxtonhall/wc/fib.sh22
2 files changed, 23 insertions, 0 deletions
diff --git a/entries/braxtonhall/wc/.gitignore b/entries/braxtonhall/wc/.gitignore
new file mode 100644
index 0000000..0aafc44
--- /dev/null
+++ b/entries/braxtonhall/wc/.gitignore
@@ -0,0 +1 @@
+**/1 \ No newline at end of file
diff --git a/entries/braxtonhall/wc/fib.sh b/entries/braxtonhall/wc/fib.sh
new file mode 100644
index 0000000..1759dff
--- /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" ] || echo "🥵" > "$1/$2"
+ 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