#!/bin/sh # Shell script to count number of files in a given directory ls | cat -n | tail -1 | grep -Eo '[0-9]{1,4}'