Write a shell script that consists of a function that displays the number of files in the present working directory, but not subdirectories
# Function to count files in the pwd excluding sub directories
files_in_pwd() {
num_files=$(ls -l | wc -l) | -maxdepth 1
echo "Number of files in the pwd: $num_files"
}
# Call the function
files_in_pwd
Use
findwith the-type foption to count only regular files, and-maxdepth 1to prevent going into subdirectories.