/ Published in: Bash

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
deftwitlogrc="~/.twitlog.rc" # # Parse command line # me=`basename $0 .sh` usage="Usage: $me [-c config-file] <message> \n\nNOTE: config-file defaults to $deftwitlogrc" while getopts ":c:" options; do case $options in c ) twitlogrc=$OPTARG;; h ) echo -e $usage exit 0;; \? ) echo -e $usage exit 1;; * ) echo -e $usage exit 1;; esac done shift $((OPTIND - 1)) # # Try and read config file # if [ -z "$twitlogrc" ] then source ${HOME}/.twitlog.rc else source $twitlogrc fi if [ $? -ne 0 ] then echo "Cannot open config file" echo echo -e $usage exit 1 fi
Comments
