shell script exercise in linux

Exercise 1: Modify the passwords of all ordinary users to random passwords, and save the random passwords in the pass.conf file; Insert picture description hereInsert picture description here
Exercise 2: Change the extension of all files in any directory under individual users to bakInsert picture description here
Insert picture description here
Insert picture description here

Exercise 3: Write a script to count how many directory files are in the / etc / directory
[-d FILE] True if FILE exists and is a directory.
Insert picture description hereInsert picture description here
Insert picture description hereInsert picture description here
Exercise 4: Write a script
1. Say hello to each user in / etc / passwd in turn, and say what the ID
of the other party is. The effect is as follows:

Insert picture description hereInsert picture description here
Exercise 5: Write a script. The
following functions are required: when executing a program, the program will let the user choose boy
or girl; if the user enters B or b, it will display: He is a boy;
if the user enters When G or g, it displays: She is a girl; if it is other than B / b / G / g
, it displays: I don't know.

Insert picture description here
Insert picture description here
Exercise 6: Write a script. It is
required to generate a random integer num1 from 0 to 9, and enter an integer num2 from 0 to 9 from the keyboard. Use num1 and num2 to perform the remainder and division operation, and compare the results of the remainder and division results.
Insert picture description here
Insert picture description here

Published 8 original articles · Like1 · Visits 388

Guess you like

Origin blog.csdn.net/weixin_42064000/article/details/104903556