Shell Programming Examples

Source: Internet
Author: User

1. Create 100 directories in the/home directory with a directory name of a1......a100.
2. Write a script that automatically packages all files less than 5KB in the home directory into XX.tar.gz. (Hint: Use Ls,grep,find and other commands, files generally refer to ordinary files)
3. Write a program that can take out the first column of/ET/PASSWD, and each column is displayed with a line of string "The 1 account is" root "
4. Write a program, his role is to look at the/root/test/logical this name exists, if not, create a file. Use touch to create, leave after creation is complete, and if present, determine if the name is a file, and if it is deleted, create a new directory. The file name is Loglical, then left, and if present, and the name is directory, delete the directory.
5. Write a shell script that reads 10 numbers from the keyboard, showing the maximum and minimum values.
6. Write a script to print any number of multiplication tables. Print If you enter 3
1*1=1
2*1=2 2*2=4
3*1=3 3*2=6 3*3=9

7. Write a script, enter your own birthday time (YYYYMMDD), and calculate how many days and hours are your birthdays.



Each instance is oneself by looking for the material to write out, through own writing, did learn a lot of things!

Shell Programming Examples

Related Article

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.