Shell Exercises - 2
- Write a shell script called lsdirs which lists just the directories in the current directory (test).
- Write a shell script that takes a uid as an argument and prints out that person's name, home directory, shell and group number. Print out the name of the group corresponding to the group number, and other groups that person may belong to. (groups, awk, cut. Also look at /etc/passwd and /etc/groups).
- Write a script that reads each line of input from a file and writes it to a target file but with an extra blank line after each line. This is creating a double line spacing of the file.
- Given a process ID (PID) as input, write a script that checks whether the process is still running or not. (hint: use ps and sleep commands)
- List all files whose size is larger than a given size in a given directory.
- Check the disk usage of a user and print a message "WARNING: Disk usage exceeding quota value" where quota is the value given as a parameter and the user name is also a parameter to the script.