#!/bin/sh set -e usage() { echo "Usage: ${0##*/} [-n] [-l length] [chars]" >&2 exit 1 } while getopts 'l:n' o; do case "$o" in l) len="$OPTARG" ;; n) nnl=false ;; *) usage ;; esac done shift $((OPTIND - 1)) [ $# -gt 1 ] && usage