Write a shell script will compress (using tar) ALL user directories (in /home) and save the backups in a rotated fashion in a predefined directory.
a. You should use three backup files for rotation and they should be named using numbers in the following format: ..tar.gz. So for the student user account, there should be three files student.1.tar.gz, student.2.tar.gz, & student.3.tar.gz with 3 being the oldest and 1 being the newest.
b. Your script should back up the directory of interest, preserving permissions and using gzip compression (add the –z) and the new backup should replace 1, 1 should replace 2, 2 should replace 3, and 3 should be deleted.
c. Your script must do this for ALL user directories in /home
Write a script which adds a list of users non-interactively.
a. Your script should read the names of the users (each on a line by themselves) from STDIN
b. Other than the defaults, set the password (to the user’s name), ensure directory creation, and lock the account after creation.
c. Your script should check to see if the user already exists and NOT attempt to add the user if the user exists (hint: `cat /etc/passwd | grep $username` and check to see if empty)
d. STDIN implies it should run like: cat /root/users | ./addusers.bsh
Write a shell script which takes a regular file from the command line, performs some basic error checking (file must exist and be readable) and displays the results of ls –l command for the given file, followed by a blank line, followed by the contents of the file line by line with each line number prepended on the same line.
a. Command line implies command will be run like: ./fileInfo.bsh filename