Question: Unix/Linux Scripting. Please provide clear Solutions and Outputs for each Question. Thanks! 1. Use the FOR loop to write a shell script that adds an

Unix/Linux Scripting. Please provide clear Solutions and Outputs for each Question. Thanks!

1. Use the FOR loop to write a shell script that adds an extension .bak to all the files in a directory by changing all the files in a directory to a .bak extension. Kindly make sure to supply the directory name as an argument while running the test script.

2. Use any loop technique to rewrite your shell script to validate password strength. Your program should prompt user for a password based on the following requirements:

-Length should be a minimum of 8 characters.

-Contain both alphabet and number.

-Include both the small and capital case letters.

-If the password entered is not valid, the program should give the user another two (2) chances to type the correct password before quitting.

-If the password doesnt comply to any of the above conditions, then the script should report it as a Weak Password otherwise display a Strong Password

3. Write a shell script to print a number in reverse order. It should support the following requirements. The script should accept the input from the command line. If you dont input any data, then display an error message to execute the script correctly.

Possible steps involved in the test script. 1. Suppose the input number is n. 2. Set reverse and single digit to 0 (i.e. rev=0, sd=0). 3. The expression (n % 10) will give the single left most digit i.e. sd. 4. To reverse the number, use this expression . 5. Decrease the input number (n) by 1. 6. If n is greater than 0, then go to step no. 3. Else, execute the step no. 7. 7. Print the result.

Note: sd and rev are just variable names. However, you dont have to use these steps as you can come up to your own way of solving the problem.

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!