FreeTstar

loving Freedom + + loving Linux

  • 首页
  • Archive
  • 关于
  • 杂七杂八
  • 留言板
Twitter Sina RSS

unix shell范例精解第七章课后习题《三》

发布于 2010年06月1日 由 freetstar
4 条评论发表评论

Mike Harrington:(510) 548-1278:250:100:175

Christian Dobbins:(408) 538-2358:155:90:201

Susan Dalsass:(206) 654-3279:250:60:50

Archie McNichol:(206) 548-1348:250:100:175

Jody Savage:(206) 548-1278:15:188:150

Guy Quigley:(916) 343-6410:250:100:175

Dan Savage:(406) 298-7744:450:300:275

Nancy McNeil:(510) 548-5258:250:80:75

John Goldenrod:(916) 348-4278:250:100:175

Chet Main:(510) 548-5258:50:95:135

Tom Savage:(408) 926-3456:250:168:200

Elizabeth Stachelin:(916) 440-1763:175:75:300

上面这个数据库的记录内容包括姓名,电话号码和最近3个月的竞选捐款数额

注:以上内容被写进chapter7这个文档

请编写一个用户自定义函数,要求该函书能返回指定月份的人均捐款数额.月份由命令行传入

文件内容:

 

  1. BEGIN{
  2. FS="[ :]"
  3. printf "*******Please input the month you want to check***** \n"
  4. getline month < "/dev/tty"
  5. }
  6. {
  7. Add(month+4)
  8. }
  9. function Add(m)
  10. {
  11. count++;
  12. total+=$m
  13. aver = total/12
  14. if(count==12) return aver
  15. else next
  16. }
  17. END{printf "The #%d month's average is %6.2f \n",month,aver}

 

分类:PROGRAM
死亡手机号0888-888-888:机主均死于非命(图)
gnome-paint – 一个简单易用的GNOME画图程序

4 则回应给 “unix shell范例精解第七章课后习题《三》”

  1. SU ROOT AUSTRALIA Google Chrome Linux 说道:
    2010年06月1日 9:05 下午

    《unix shell范例精解》这本书好吗?对于我这样几乎没有shell脚本经验的人来说适合作为入门书吗?
    Shell真是好东西!连长学会了教我哦.

    [回复]

    freetstar CHINA Google Chrome Linux 回复:
    六月 1st, 2010 at 10:15 下午

    怎么讲呢,比较适合,例子比较多,然后可以挑自己要看的章节看,不过页数比较多.
    shell太强大了

    [回复]

    SU ROOT AUSTRALIA Google Chrome Linux 回复:
    六月 2nd, 2010 at 8:42 下午

    恩,启动的时候加载脚本,靠,太爽了!Computer就是我的奴隶了!

    [回复]

    admin CHINA Google Chrome Linux 回复:
    六月 2nd, 2010 at 9:25 下午

    high吧.强大的脚本

    [回复]

发表评论 取消回复

电子邮件地址不会被公开。 必填项已用 * 标注

*

*


疑问 开心 悲伤 邪恶 惊叹 微笑 脸红 笑 惊讶 惊奇 迷惑 酷 憨笑 生气 阴险 转眼球 眨眼 主意 箭头 中立 哭 大笑

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image

点击取消回复
第 1 页,共 1 页1
  • 欢迎订阅

  • Github

  • 近期评论

    • freetstar CHINA Mozilla Firefox Linux 发表在《留言板》
    • _Fly CHINA Google Chrome Linux 发表在《使用e4rat加速你的linux启动速度(ext4文件系统专用)》
    • walfred Mozilla Firefox Windows 发表在《留言板》
    • freetstar CHINA Mozilla Firefox Windows 发表在《用landslide创建html5 slide》
  • Spread Firefox Affiliate Button
  • 我的豆瓣

  • 链接表

    • 51开源社区
    • Adam's
    • delectate's blog
    • Don's
    • fl
    • ghostunix
    • Jasey Wang
    • Jerry's Blog
    • Moolight@Ericyue
    • OSMSG
    • panda
    • Pity is the Bomp
    • PT ubuntu
    • Tao Zhu
    • ubuntuhome
    • WOW!ubuntu
    • zhangzhfang
    • 丕字的blog
    • 傻东の学习笔记
    • 奶牛的blog
    • 孤风颠影
    • 弯柚博客
    • 熊猫党军委主席
    • 靖 轩
    • 马力哥
    • 黑孩儿
  • 我的支付宝

  • 功能

    • 登录
    • 文章 RSS
    • 评论 RSS
    • WordPress.org
© FreeTstar. WordPress 强力驱动 | Nest Theme by YChong