#!/bin/sh # HomeDir [user]... # # Produce a list of the home directories of the listed users. # If no users are given, produce all home directories. { if [ $# -lt 1 ];then cat /etc/passwd else for u do grep '^'$u':' /etc/passwd done fi } | sed -e 's/.*:.*:.*:.*:.*:\(.*\):.*/\1/' |sort |uniq