Linux script exercises

Source: Internet
Author: User

Linux script exercises

Example 1: write a script and use the loop and continue keywords to calculate the sum of the three divisible numbers within 100

Running result:

Example 2: write a script and use the loop and continue keywords to calculate the sum of the three divisible numbers within 100

Running result:

Example 3: write a script to download the tar.gzor tar.bz2 file.

Running result:

Example 4: write a script to help you query rpm information. This script first prompts the user to select the query basis, such as the file name, package name, and all. Then, the user is prompted to select the query information, such as the package name, all files contained in the package, and package information. Then ask if you want to continue the query.

 

#! /Bin/shcase ${1 # *. tar.} in bz2) tar jxvf $1; gz) tar zxvf $1; *) echo "wrong file type" esac


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.