This question already has an answer here:
Create a script to ask a user for the name of a folder and have the script return the number of files found within the folder. If folder doesn't exist, display error message to the screen
I've gotten the first part of this question completed, and I'm aware that a variable will need to be created to store the num of files found in the folder. I'm just stuck on how to return the number of files found. Any advice on how I would go about doing this? I know the
ls command will be used.
clear echo -e "Option #11: Acquire the number of files within a particular folder\n\n" echo -e "Enter in the Folder Name below\n" read foldername answer=$(grep $foldername) if [ "$answer" = "" ] then clear echo -e "\n No Such Folder Exists" else