Linux lab-shell programming

Source: Internet
Author: User

Linux lab-shell programming

1. view the values of environment variables defined by the user shell in the current system.
2. Define the value of the variable AK to 200 and display it on the screen.
3. Define the value of the variable AM to 100, and use the test command to compare whether the value is greater than 150.
4. Create a simple shell program with the following functions:
1) Change the host name to your name;
2) display the Host Name of the computer and the system date and time.
5. Use the if-then-else statement to create a shell program that determines whether the score passes based on the input score.
6. Use the for statement to create a shell program that calculates the sum of all integers on the command line.
7. Use the while statement to create a shell program that calculates the square value from 1 to 5.
8. Use the while statement to create a shell program that calculates the sum (1 + 2 + 3 + 4 +... + n) based on the input value n.
9. Use the for statement to create a shell program. The function is 1 + 2 + 3 + 4 + 5 +... + n.
10. Use the until statement to create a shell program with the function of computing 1 ~ 10 square.
11. Design a shell program and create 100 directories under the/home directory, that is, XXX1 ~ XXX100, and set
Permissions for each directory, where the permissions of the file owner are: read, write, and execute; permissions of the group where the file owner is located
Is: read and execute; other users have the following permissions: read and execute;
12. Write a shell program to automatically delete 50 accounts in question 1st. Account name: XXX1 to XXX50;
13. Compile a shell program. Requirement: display the score level based on the score of the student input from the keyboard.
"Failed!" under 60 points !", 60-70 is divided into "Passed !", 70-80 is divided into "Medium !", 80-90
"Good !", 90-100 is "Excellent !".
14. A system administrator needs to do some repetitive work every day. Prepare a solution according to the following requirements:
(1) Delete All subdirectories and all files under the/abc directory;
(2) archive and compress all directories and files under the/data directory at every Monday:
Backup.tar.gz;
(3) uninstall the CD-ROM of the IDE interface at PM (assuming the device name of the CD-ROM is hdc );
(4) Start the instance in the morning.
15. Design a Shell program,
Check whether the file name in the/home directory is XXX80 ~ XXX90 directory, if any,
Delete them. Note: Do not delete other directories;
16. Design a shell program, add a new group testgroup, and add 30 users to the group.
Name format: XXX ??, Where ?? From 01 to 30.

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.