#!/bin/sh # Dirmatch - take in standard input a list of directory name patterns, # then print the matches of the directory names from each item in the list. while read line do echo echo "=== $line ===" ls -1 | grep -i "$line" done