码迷,mamicode.com
首页 > 系统相关 > 详细

Shell 练习题 20180111

时间:2018-01-11 15:39:39      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:使用   脚本   pos   ash   span   shell   bin   shell 脚本   nbsp   

请详细查看如下几个数字的规律,并使用 shell 脚本输出后面的十个数字

10  31  53  77  105  141  ......

[root@localhost ~]# cat 1.sh
#!/bin/bash

a=20
b=2
c=10
echo $c for i in `seq 0 20` do let d=${a}+${b}**${i} let c=${c}+${d} echo $c done
[root@localhost ~]# sh 1.sh
10
31
53 77 105 141 193 277 425 701 1233 2277 4345 8461 16673 33077 65865 131421 262513 524677 1048985 2097581

 

 

 

 

         

Shell 练习题 20180111

标签:使用   脚本   pos   ash   span   shell   bin   shell 脚本   nbsp   

原文地址:https://www.cnblogs.com/pzk7788/p/8267604.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!