#!/bin/sh [ "$1" = "info" ] && echo "show this very message" && exit 2 cat << EOF $progname -- daemonless posix pomodoro timer usage: $progname [options] [action] [action options] options: -h, --help show help actions: EOF IFS=':' find $path -type l,f -perm /u=x,g=x,o=x 2>/dev/null | while read -r action ; do action_name="$(basename "$action")" if [ -L "$action" ] ; then printf '%s\t%s\n' "$action_name" "same as $(basename "$(readlink -f "$action")")" else action_info="$("$action" info)" [ $? -eq 2 ] && printf '%s\t%s\n' "$action_name" "$action_info" fi done | awk ' BEGIN { FS = "\t" } { if (printed[$1]) next printf("\t%-13s %s\n", $1, $2) printed[$1] = 1 } ' cat << EOF if no action is provided, the \`state\` action is chosen by default EOF