#!/bin/sh if [ "$1" = "" ]; then echo "Usage: $0 TYPE files" else if [ "$1" = "-h" ]; then echo "Usage: $0 TYPE files" echo "Filters out files of type TYPE" echo "" echo "TYPE meaning" echo "-b Block special file" echo "-c Special character file" echo "-d Directory" echo "-e Exists" echo "-f Not a directory" echo "-G Exists and is owned by effective group-ID" echo "-g Set-group-id bit is set" echo "-k Sticky bit is set" echo "-L Symbolic link" echo "-O Exists and is owned by effective user-ID" echo "-r Readable" echo "-S Socket file" echo "-s Size is nonzero" echo "-u Set-user-id bit is set" echo "-w Writable" echo "-x Executable" echo "" echo "Example: To list only directories:" echo "$0 -d *" else for i in "$@"; do if [ "$1" "$i" ]; then echo $i fi done fi fi