Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This script is called filemenu and is designed to present a simple user menu for

ID: 3682564 • Letter: T

Question

This script is called filemenu and is designed to present a simple user menu for someone not familiar with basic UNIX commands for file and directory access. When the script is run, it should first change to the home directory of the user running the script (independent of the directory from which it is run). The script runs in a continuous loop of displaying the following menu, executing the requested action, and then re-displaying the menu. The menu consists of a display of the full path name of the current working directory and a list of choices for the user: ("all" here means non-hidden)

a) list non-executable files – lists all ordinary non-executable files in the current working directory

b) list executable files – lists all ordinary executable files in the current working directory

c) list subdirectories – lists all subdirectories in the current working directory

d) display a directory – prompts the user for input; display the content of the selected directory [NOTE: the requested directory must be a subdirectory of the current directory; otherwise, report that the directory does not exist and repeat the menu display]

e) display a file - prompts the user for input; displays the selected file (must be one selected from the current working directory). If the file does not exist in the current working directory, an error message is displayed, then repeat the menu display.

f) exit - quit the menu script

Once the user has finished looking at the output, you must have means for clearing the screen (using CLEAR command) and re-displaying the menu. You may assme the user is familiar with the basic UNIX paging programs.

Explanation / Answer

#!/bin/bash

# script

#for loop for repeat process

for File in *

doif [ -r $File -a -w $File -a -x $File ]

then

echo $File

ls -l

fi

done

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote