Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

UNIX/LINUX QUESTION. Please, Solutions Only. Thanks! 1. Use the FOR loop to write a shell script that adds an extension .bak to all the files

UNIX/LINUX QUESTION. Please, Solutions Only. 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.

4. For given numbers 1 to 10, display any number that is less than 5 and stop the loop.

5. For given numbers 1 to 10, display only odd numbers: 1,3,5,7,9.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions