add shell script version

This commit is contained in:
overflowerror 2020-07-08 15:39:08 +02:00
parent 1f7eef93c3
commit 124e4d81a2

16
shell/fibonacci.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
fibonacci() {
i="$1"
if test "$i" = 0; then
cat
return 0
fi
(tee /dev/stderr | tail -n 2 | awk '{s += $1} END {print s}') 2>&1 | fibonacci $((i - 1))
}
fibonacci 5 <<EOF
1
1
EOF