home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # listalias: part of the Elm mail system
- # @(#)$Id: listalias.SH,v 5.1 1993/04/12 02:10:26 syd Exp $
- # Copyright (c) 1988-1992 USENET Community Trust
- # Copyright (c) 1986,1987 Dave Taylor
-
- USAGE="usage: $0 [-u | -s] [optional-regular-expression]"
-
- opts=
-
- while : ; do
- case "$1" in
- -u|-s) opts="$opts $1" ; shift ;;
- --) shift ; break ;;
- -*) echo "$USAGE" 1>&2 ; exit 1 ;;
- *) break ;;
- esac
- done
-
- listit="elmalias -v $opts"
- grepit=
- sortit="| sort"
-
- case "$#" in
-
- 0) ;;
-
- 1) # BSD uses "-y" for case insensitive, SysV uses "-i".
- grepit="| grep \"$1\""
- for flag in -i -y ; do
- x=`echo HELLO | grep $flag hello 2>/dev/null`
- if test $? -eq 0 -a "X$x" = "XHELLO" ; then
- grepit="| grep $flag \"$1\""
- break
- fi
- done
- ;;
-
- *) echo "$USAGE" 1>&2
- exit 1
- ;;
-
- esac
-
- eval "$listit $grepit $sortit"
- exit $?
-