Question: Problem 1 Write a shell script whose single command line argument is a directory. Your script should perform the following: - If you run the

Problem 1
Write a shell script whose single command line argument is a directory. Your script should perform the following:
- If you run the program with more than one argument or no argument, the script should display an appropriate message.
- If you run the script with a directory, the script should display the name of each subdirectory in that directory.
- If the command line argument is not a directory, the script should display an appropriate message.
Note: your script should not prompt the user to enter a directory. It should be executed with arguments.
Save the script as problem1.shin the assignment3 directory.
Problem 2
Write a shell script whose single command line argument is a directory. Your script should perform the following:
- If you run the program with more than one argument or no argument, the script should display an appropriate message.
- If you run the script with a directory, the script should display the name and type of each item in that directory.
- If the command line argument is not a directory, the script displays an appropriate message.
Sample output if the argument is a directory:
Name: Documents Type: directory
Name: sh1.sh Type: regular file
Save the script as problem2.sh in the assignment3 directory.
Problem 3
Write a shell script whose single command line argument is a directory. Your script should perform the following:
If you run the program with more than one argument or no argument, the script should display an appropriate
message.
If you run the script with a directory, the script should display the number of subdirectories and the number of
regular files in that directory.
If the command line argument is not a directory, the script should display an appropriate message.
Sample output if the argument is a directory:
Number of subdirectories: 10 Number of regular files: 12
Save the script as problem3.sh in the assignment3 directory.
Problem 4
Write a shell script whose single command line argument is a directory. Your script should perform the following:
If you run the program with more than one argument or no argument, the script should display an appropriate
message.
If you run the script with a directory, the script should display the number of empty files in that directory.
If the command line argument is not a directory, the script should display an appropriate message.
You may use the touch command to create empty files for testing.
Syntax: touch filename
Save the script as problem4.sh in the assignment3 directory.
help with scripting and what to type to get outputs???
Problem 1 Write a shell script whose single

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 Programming Questions!