📄 hanoi.sh
字号:
#!/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -