Write a bash script that prompts a user with a menu of choices:
Get the total number of shell files from the current directory
Get the total size of all the shell files from the current directory
Get the total number of empty files in the system from the current directory
Each option must be its own specific function. linux only
Get the total number of shell files from the current
directory.
find -name '*.sh' -print | wc -l
Get the total size of all the shell files from the current
directory
find -type f -name '*.sh' -exec du -ch {} + | grep
total$
Get the total number of empty files in the system from the current directory
find -size 0 | wc -l
Here is a bash script that prmotps user with a menu a given
choices.
!/bin/bash
options=("1- Get the total number of shell files from the current directory" "2- Get the total size of all the shell files from the current directory" "3- Get the total number of empty files in the system from the current directory")
select num in "${options[@]}"
do
case $num in
"1- Get the total number of shell files from the current directory")Here is
find -name '*.sh' -print | wc -l
;;
"2- Get the total size of all the shell files from the current directory")
find -type f -name '*.sh' -exec du -ch {} + | grep total$
;;
"3- Get the total number of empty files in the system from the current directory")
find -size 0 | wc -l
;;
esac
done
Here is the menu file/bash script:

Here is the output:

Write a bash script that prompts a user with a menu of choices: Get the total...
I need a bash script that prompts the user for a filename within a directory, and if the file/subdirectory exists to gzip them. Directories should be tarred and zipped, files should just be gzipped. This should poll inside of a loop to keep prompting the user until the user ends the script.
In Putty
1. Create Bash shell script that would let a user make a copy of all the files in a directory. (3 points) 2. Create two Bash shell scripts that will perform some work (of your choice). (2*3 = 6 points) 3. Create a Bash shell script that would serve as a menu for the three scripts you have created. (1 point)
write the bash script Write a script compress_large_files.sh. This script accepts one or more command line arguments. The first argument has to be an integer; let’s call it size. If this is the only command line argument, compress_large_files.sh inspects all files in the current working directory and compresses every file of size at least size. If there is more than one command line argument, all arguments except the first one must be valid directories. In this case, compress_large_files.sh inspects the...
NIT1202 Operating Systems UNIX Script You are required to write a Bourne Again Shell Script (bash) to manage a menu driven program. When executed the user should be presented with a menu with 4 (four) options: Print the following user information: the home directory, path, userid , login shell together with the current date and time. Ask a user a range and it displays eight random number between the range. [Range difference must be 100. Example Enter a range: 200...
In LINUX Q1 A) Create a user with name “user1” from root directory. B) Change “user1” shell to “/bin/bash” from root directory. C) Delete the user “user1” from root directory. D) Set a password for “user2” from local user directory. E) Add “user2” to group “java”. Q2: Write a menu script that has 3 option: a) Option 1: list all file in current directory. b) Option 2: ask user enter a number n, and print 1 to n to screen...
1.Write a bash script A5p1.sh to output the number of executable and non-executable files and subdirectories separately in the directory that is specified as the first command line argument to this script. Do not count recursively in subdirectories. Do not call any external Linux utilities such as “ls”. 2.Write a bash script A5p1.sh to output the number of executable and non-executable files and subdirectories separately in the directory that is specified as the first command line argument to this script....
Homework No.2 CSC 222 Write a shell script program called "countf.sh" that will count how many files or directories recursively. beside the file counts, also report how many files for each types (directory or regular files). It will either take arguments for specific directories and no argument. If no argument, it will read the current working directory as the starting point. Please also provide -h option to print out how to use your countf.sh program % ./countf.sh % ./countf.sh file1...
Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...
Write a bash shell script to carry out each of the following tasks: What to Do: a. Safe Delete: When you use the “rm” command in Linux, it will delete the specified files, with no chance for recovering them back later. Write a script (called srm) that will safely delete the files passed to it as command-line arguments. For example, typing the command: “srm file1 file2 file3”, the script shall not actually delete these files, but instead it shall move...
UNIX Write and run a simple shell script name mymenu that creates a simple command menu. The script should present menu items (see below), prompts the user for a selection, and then executes the appropriate command selected. [Submit your script and the results of a test case for a, b, c, and d selections] COMMAND MENU a. Current date and time b. Name of the working directory c. Contents of the working directory Enter a, b, or c: