汉诺塔Shell (bash)实现

#!/bin/bash
#利用函数实现汉洛塔问题(需要用户输入盘子数,输出每个盘子的移动步骤,盘子从上到下为编号为n-1)
#输入提示
a=a
b=b
c=c
function mv()
{
if [ $1 -eq "1" ];then
echo  "$2 -> $4 "
else
{
mv $[$1-1] $2 $4 $3
echo  "$2 -> $4"
mv $[$1-1] $3 $2 $4
 }
fi
}
read -p "Please enter the number of plates you want to move: " n;
mv $n $a $b $c
exit 0 
汉诺塔Shell (bash)实现