#!/bin/sh # Utility to count the number of files in current directory. # Basic idea: # Do a directory listing (long version) # Remove the line that mentions "total " # Prune the list to just have regular files # Do a word count on this to count the number of lines ls -l | grep -v "total " | grep "^-" | wc -l