shell conditional test practice questions

1. Take out line 6 of the /etc/passwd file;

 2. Take out the shells of all users on the current system. It is required that each shell is only displayed once and displayed in order;

Use cut, sort combined with pipeline implementation

pass: sort is for sorting - u is for deduplication 

3. If the number of lines in the /var/log/messages file is greater than 100, it will display a very large file

4. Display all files starting with pa in the /etc directory, and count their numbers

5. If the user hadoop does not exist, add it, otherwise it will display that the user already exists

 6. Write a shell program mkf. The function of this program is: display the file information under root, then create a kk folder, create a file aa under this folder, and modify the permission of this file to be executable

 7. Write a shell program test3, read a directory name from the keyboard when the program is executed, and then display the information of all files in this directory

 8. Write a shell program test4, read the values ​​of x and y from the keyboard, then do addition, and finally output the result

 

 

Guess you like

Origin blog.csdn.net/m0_68976043/article/details/130625574