1 Star 0 Fork 138

我的天呐/Shell脚本练习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
19011111issue3.sh 524 Bytes
一键复制 编辑 原始数据 按行查看 历史
我的天呐 提交于 2021-06-10 23:40 +08:00 . 19011111issue3.sh
#!/bin/bash
if (test -z $1) ;
then
read -p "Input Max Int Lines:" MAX
else
MAX=$1
fi
for ((i=1;i<=MAX;i++))
do
for ((j=1;j<=i;j++))
do
f=$(($i-1))
g=$(($j-1))
if [ "$j" == 1 ];
then
declare SUM_${i}_$j=1
else
declare A=$[SUM_${f}_$j]
declare B=$[SUM_${f}_$g]
declare SUM_${i}_$j=`expr $A + $B`
fi
echo -n $[SUM_${i}_$j]
echo -en " "
done
echo " "
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/wayiii/shell_script_exercise.git
git@gitee.com:wayiii/shell_script_exercise.git
wayiii
shell_script_exercise
Shell脚本练习
master

搜索帮助