hanoi.sh
来自「bash debugger. You can use this tool to 」· Shell 代码 · 共 48 行
SH
48 行
#!/usr/bin/bash# $Id: hanoi.sh.in,v 1.7 2006/12/10 18:08:50 rockyb Exp $# Towers of Hanoi# We've added calls to set line tracing if the 1st argument is "trace"init() { # We want to test _Dbg_set_trace inside a call if (( $tracing )) ; then _Dbg_linetrace_on fi}hanoi() { local -i n=$1 # Mul # _Dbg_set_trace local -r a=$2 local -r b=$3 local -r c=$4 if (( n > 0 )) ; then (( n-- )) hanoi $n $a $c $b ((disc_num=max-n)) echo "Move disk $n on $a to $b" if (( n > 0 )) ; then hanoi $n $c $b $a fi fi}typeset -i max=3typeset -i tracing=0if [[ "$1" = 'trace' ]] ; then if [[ -n $2 ]] ; then builddir=$2 elif [[ -z $builddir ]] ; then builddir=`pwd` fi tracing=1 source ${builddir}/bashdb-trace -q -L ../ -B -x settrace.cmdfiinithanoi $max "a" "b" "c"if (( $tracing )) ; then _Dbg_linetrace_off BASHDB_QUIT_ON_QUIT=1fi
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?