#!/bin/sh usage() { echo "usage: packaddr [-l] searchstring" >&2 echo "use \`-l' to search on location instead of callsign" >&2 exit 1 } if [ $# -lt 1 ]; then usage; fi while getopts ":l" c do case "$c" in l) l_flag=1;; :|'?') usage;; esac done if [ $OPTIND -lt $# ]; then usage; fi shift $((OPTIND - 1)) if [ -n "$l_flag" ]; then grepstr="@.\+$1.*$" else grepstr="$1.*@[^!]\+$" fi if ! grep -i $grepstr /home/mats/radio/packet/lists/smpack.txt; then echo "No match found." fi .