Shell脚本练习题

  • A+
所属分类:运维教程
摘要

作为一枚十分贴心的杜老师,在此给大家准备了六道Shell脚本练习题。都是入门级的水准,希望大家踊跃尝试编写。答案是隐藏的,回复可见。如有任何问题,欢迎在评论去与我互动!

脚本题目

  1. 编写脚本,计算1到100的总和;
  2. 编写脚本,输入一个数字n并计算1到这个数的总和。要求:如果这个数小于等于1,要求重新输入,直到输入大于1的数字为止;
  3. 编写脚本,把/root/目录下的所有目录复制到/tmp/目录;
  4. 编写脚本,批量建立用户,要求用户名的格式为user_00/user_01,建立100个,且用户同属于users组;
  5. 编写脚本,在/cjk/目录下的所有文件(不含目录)的文件名后面加.bak。
  6. 编写脚本,给系统中所有已存在的用户打个招呼,格式参考为hello penndu and your id is 1000。

参考答案

此处为隐藏的内容!
登录后方可查看!
  • 问答中心
  • 微信小程序扫一扫
  • weinxin
  • 微信公众
  • 微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:27   其中:访客  27   博主  0

    • avatar find this

      Hmm is anyone else experiencing problems with the pictures on this blog loading? I’m trying to figure out if its a problem on my end or if it’s the blog. Any feed-back would be greatly appreciated.

      • avatar grolyrto lemcs

        I went over this internet site and I conceive you have a lot of fantastic info , saved to my bookmarks (:.

        • avatar cbd oil that works 2020

          Hi, i think that i saw you visited my blog so i came to
          “return the favor”.I’m attempting to find things to enhance my site!I suppose
          its ok to use a few of your ideas!!

          • avatar www.vianchi.com

            Oh my goodness! Impressive article dude! Thank you so much,
            However I am encountering difficulties with your RSS.
            I don’t understand why I cannot join it. Is there anyone else getting identical
            RSS issues? Anybody who knows the solution will you kindly respond?
            Thanx!!

            • avatar http://j.mp/3drY6lE

              Cbd oil that works 2020
              What’s up, this weekend is nice in favor of me, for the reason that this time i am reading this enormous informative paragraph here at my residence.
              best rated cbd oil http://j.mp/3drY6lE cbd oil that works 2020
              http://j.mp/3drY6lE

              • avatar weitere Informationen …

                obviously like your web-site however you have to check the spelling on quite a few of your posts. A number of them are rife with spelling problems and I to find it very bothersome to inform the reality on the other hand I’ll definitely come again again.

                • avatar https://tinyurl.com/rsacwgxy g

                  Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I acquire in fact enjoyed account your blog posts.
                  Any way I will be subscribing to your augment and even I achievement you access consistently quickly.