How does the script capture how many passwords the user wants?
fold number converts a prompt into an integer.
fold number
read number stores one line of input in the variable number.
read number
number
echo number reads the requested count from standard input.
echo number
head number prompts interactively and stores the reply.
head number