Skip to content

Commit

Permalink
Add more interesting code snippet for Bash
Browse files Browse the repository at this point in the history
  • Loading branch information
camerondurham committed Jan 28, 2024
1 parent d0ba018 commit 1c57d9c
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion web-frontend/js/set-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,25 @@ func main() {
);
} else if (lang === "bash" || lange === "sh") {
codeMirror.setValue(
"echo hello world from bash!"
`
# Function to print Fibonacci Sequence
function print_fibonacci() {
num=$1
a=0
b=1
echo "The Fibonacci sequence for $num terms is: "
for (( i=0; i<num; i++ ))
do
echo -n "$a "
fn=$((a + b))
a=$b
b=$fn
done
}
print_fibonacci 5
`
);
} else {
codeMirror.setValue(
Expand Down

0 comments on commit 1c57d9c

Please sign in to comment.