Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write shell scripts to complete the following tasks. Task A - Take your UIN Write a script like below that reads and displays the
Please write shell scripts to complete the following tasks. Task A - Take your UIN Write a script like below that reads and displays the MIDAS ID if the following requirements are satisfied: 1. Only lower case letter [a-z] and numeric character[0-9] are allowed 2. MIDAS ID must between 4 to 8 digits Test your script with the following examples: Your MIDAS ID in lower case Your MIDAS ID with one upper case A string less than 4 digits A string longer than 8 digits studentakali:-/scripts$ ./read_midas.sh Enter your ODU MIDAS ID: pji You must enter a valid midas ID - four to eight digits only! Please re-enter your MIDAS ID: pjiang000 You must enter a valid midas ID - four to eight digits only! Please re-enter your MIDAS ID: Pjiang You must enter a valid midas ID - four to eight digits only! Please re-enter your MIDAS ID: pjiang Thank you, your MIDAS ID is: pjiang Task B - Check files Write a script like below that gets a list of files in a directory you entered, plus your name. Your script should pop out an error if an invalid directory is entered. You need to test the following directories with your script: /etc/systemd /home A directory that does not exist studentakali:-/scripts$ ./list_dir.sh Enter the name of directory you want to check: /etc/systemd Enter your name: Peng Hello, Peng! Below are the contents in the requested directory: /etc/systemd journald.conf logind.conf network networkd.conf pstore.conf resolved.conf sleep.conf system system.conf timesyncd.conf user user.conf studentakali:-/scripts$ ./list_dir.sh Enter the name of directory you want to check: /home Enter your name: Peng Hello, Peng! Below are the contents in the requested directory: /home student studentakali:-/scripts$ ./list_dir.sh Enter the name of directory you want to check: /home/student2 Enter your name: Sorry, Peng. /home/student2 is not a valid directory name! studentakali:-/scripts Peng Please note: Each student needs to screenshot your source code, as well as add necessary explanations to the core parts, for example, the logic behind the code, and the design of the control flow, etc
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started