mirror of
https://github.com/sigmasternchen/fibonacci
synced 2025-03-15 08:08:58 +00:00
add shell script version
This commit is contained in:
parent
1f7eef93c3
commit
124e4d81a2
1 changed files with 16 additions and 0 deletions
16
shell/fibonacci.sh
Executable file
16
shell/fibonacci.sh
Executable 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
|
Loading…
Reference in a new issue