mercredi 6 mai 2020

Unix shell script for identifying the number of files in a directory

I am planning to write a program with the following requirements: The program should continuously ask the user to guess the number of files in the current directory, until they guess the correct number. The user will be informed if their guess is too high or too low. Once the user guesses the correct number of files in the current directory they should be congratulated.

program should have the following behavior:

When the program starts the user should be asked how many files are in the current directory, and then the user should be prompted for a guess. If the user's answer is incorrect the user should be advised that their guess was either too low or too high and then they should be prompted to try to guess again. If the user's guess is correct then they should be congratulated and the program should end. The program should not end until the user has entered the correct number of files in the current directory. The program should be able to be run by entering bash into the console.

The program should contain at least one function, one loop, and one if statement. The program should be more than 20 lines of code but less than 50 lines of code.

Anyone can you please help with this ?

Aucun commentaire:

Enregistrer un commentaire