The Unix Workbench | Johns Hopkins University

The 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.

The makefile should produce the which should contain the following information:

  • The title of the project.

  • The date and time at which make was run.

  • The number of lines of code contained in

  • The should be produced entirely from the makefile and should not be edited by hand.


numfiles=$(ls -1 | wc -l)

function user_guess {
  echo "Guess how many files are in the current directory:"
  read response


while [[ $response -ne $numfiles ]]
  if [[ $response -gt $numfiles ]]
    echo "Guess is too high"
    echo "Guess is too low"
echo "Guess is correct. Congratulations!"


	echo "# Bash, Make, Git, and GitHub" >
	echo "The date and time at which make was run:" >>
	date >>
	echo "\n" >>
	echo "The number of lines of code contained in" >>
	wc -l | egrep -o "[0-9]+" >>