0
我遵守本手冊瘦使用bashdb: http://archive09.linux.com/articles/153383.html#commentthis 當我使用bashdb對Bt腳本:如何使斷點工作在bashdb
#!/bin/bash
version="0.01";
fibonacci() {
n=${1:?If you want the nth fibonacci number, you must supply n as the first parameter.}
if [ $n -le 1 ]; then
echo $n
else
l=`fibonacci $((n-1))`
r=`fibonacci $((n-2))`
echo $((l + r))
fi
}
for i in `seq 1 10`
do
result=$(fibonacci $i)
echo "i=$i result=$result"
done
這裏是的細節調試: kaiwii @ Ubuntu的:〜/ shell_test $慶典--debugger ./fibonacci.sh bashdb調試,釋放4.2-0.6
Copyright 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
(/home/kaiwii/shell_test/fibonacci.sh:3):
3: version="0.01";
bashdb<0> bt
->0 in file `./fibonacci.sh' at line 3
##1 main() called from file `./fibonacci.sh' at line 0
bashdb<1> next
(/home/kaiwii/shell_test/fibonacci.sh:16):
16: for i in `seq 1 10`
bashdb<2> list
11: r=`fibonacci $((n-2))`
12: echo $((l + r))
13: fi
14: }
15:
16: => for i in `seq 1 10`
17: do
18: result=$(fibonacci $i)
19: echo "i=$i result=$result"
20: done
bashdb<3> next
(/home/kaiwii/shell_test/fibonacci.sh:18):
18: result=$(fibonacci $i)
bashdb<4> break fibonacci
Breakpoint 1 set in file /home/kaiwii/shell_test/fibonacci.sh, line 5.
bashdb<5> continue
i=1 result=1
i=2 result=1
i=3 result=2
i=4 result=3
i=5 result=5
i=6 result=8
i=7 result=13
i=8 result=21
i=9 result=34
i=10 result=55
我的問題是,當我使用的命令,繼續後ū唱命令,打破斐波那契,它在方法開始時停止,斐波那契,但是退出腳本。
我嘗試第二種方式,但補丁提示這樣的錯誤,如:kaiwii @ ubuntu:/ usr/share/bashdb/lib $ sudo patch -p0 2012-03-07 03:05:18
該補丁應該不言自明 - 有些行會被添加。找到文件,編輯它並添加行。對於你我覺得也不得不補充:在你編輯它之後保存文件。 – rocky 2012-03-07 11:29:04