Mercurial > utils
view trac-digest.sh @ 13:b73ad8a02942
Added/updated copyright notice.
author | Oleksander Gavenko <gavenko_a@3g.ua> |
---|---|
date | Wed, 20 Feb 2008 22:43:11 +0200 |
parents | b78e329514b8 |
children |
line wrap: on
line source
#!/bin/sh # -*- mode: utf8-unix -*- # In Public Domain. # Copyright (C) 2008 by Oleksandr Gavenko <gavenko_a@3g.ua> user= pass= status= while [ "$1" ]; do case "$1" in -h|-help|--help) echo "Usage:" echo " > $0 [--help] -u <user> -p <pass>" echo "or with long options:" echo " > $0 [--help] --user=<user> --password=<pass>" exit 0 ;; -u) shift if [ "$1" == "" ]; then echo "Could not found username." exit 1 else user="$1" status=o${status} fi ;; "--user="*) user=${1#--user=} status=o${status} ;; -p) shift if [ "$1" == "" ]; then echo "Could not found password." exit 1 else pass="$1" status=${status}k fi ;; "--password="*) pass=${1#--password=} status=${status}k ;; *) echo "$1 unsuported options." exit 1 ;; esac shift done if [ "$status" == "ok" ]; then md=`echo -e "${user}:trac:${pass}\c" | md5sum --binary -` md=${md% *-} echo "${user}:trac:${md}" exit 0 else echo "You give duplicate options. Try" echo " > $0 --help" exit 1 fi