Question: Q.1. (30 points) Given the following directory structure. Write a shell script that takes file names as command line arguments. / -> tmp -> etc

 Q.1. (30 points) Given the following directory structure. Write a shell

Q.1. (30 points) Given the following directory structure. Write a shell script that takes file names as command line arguments. / -> tmp -> etc -> home -> Desktop -> CSE232fall ->labworki.txt ->labwork2.txt ->assignment.txt -> CSE232 spring ->assignment.txt -> Downloads -> dl.pdf -> usr a. Write the last 5 lines of labworki.txt into a file named lines. b. Your current diractory is CSE232 fall. Change your current directory as CSE232 spring. C. Copy all labworks under CSE232fall directory to CSE232 spring directory with a single command. d. Change your current directory as Downloads. Then change the permissions of di.pdf as: give read, write and execute rights to the user, remove execute right from the group and do not change other rights of the group; remove write and execute rights from others and do not change other rights of others. Q.2. (35 points) Write an shell script that takes three command line arguments. The command line arguments are file names. First, check if it has exactly three arguments. If not, display an error message and exit. Then, in a loop, for each command line argument, check if such a file exists in the current directory. If it exists, print the number of words in the file; otherwise display the message "wrong file name and count it. At the end, print the count (number files that do not exist)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!