#!/bin/bash
o_arry="1 2 3 4 5"
n_arry=""
function number_stack(){
count=$1
[ $count = $2 ]&&{
echo edges:$count
}||{
count=$(( $count + 1 ))
echo push:$1
number_stack $count $2
echo pop:$1
count=$(( $count - 1 ))
}
}
function arry_stack(){
local arry_len=$#
local inp1=$1
[ $arry_len = 0 ]&&{
:
}||{
echo push:$o_arry
shift;o_arry="$*"
arry_stack $o_arry
n_arry="${n_arry} $inp1"
echo pop:$n_arry
}
}
#数字
number_stack 0 5
#参数
arry_stack $o_arry
echo top:$n_arry
shell的递归(数字,参数)
最新推荐文章于 2023-12-26 08:00:00 发布