#============================================================================== # Section: Argument Parsing #============================================================================== NAME="" NOTEBOOK="" SECTION="" if [ -z "$1" ]; then #If no input was given, print help help exit else #Assume the user wants to do something. ARGS=( "$@" ) for ARG in ${ARGS[@]};do if [ "$ARG" = "-c" -o "$ARG" = "--create" ]; then CREATE="TRUE" elif [ "$ARG" = "-d" -o "$ARG" = "--delete" ]; then DELETE="TRUE" elif [ "$ARG" = "-e" -o "$ARG" = "--edit" ]; then EDIT="TRUE" elif [ "$ARG" = "-ce" -o "$ARG" = "-ec" ]; then EDIT="TRUE";CREATE="TRUE" elif [ "$ARG" = "-p" -o "$ARG" = "--print" ]; then PRINT="TRUE" elif [ "$ARG" = "-l" -o "$ARG" = "--list" ]; then LIST="TRUE" elif [ "$ARG" = "-h" -o "$ARG" == "--help" ]; then help; exit 0 elif [ "$ARG" = "-w" -o "$ARG" == "--wconf" ]; then writeconf; exit else if [ -z "$NAME" -a -n $ARG ]; then NAME=$ARG echo "Name: $NAME" elif [ -z "$NOTEBOOK" -a -n $ARG ]; then NOTEBOOK=$ARG echo "Notebook: $NOTEBOOK" elif [ -z "$SECTION" -a -n $ARG ]; then SECTION=$ARG echo "Section: $SECTION" fi fi done fi #============================================================================== # End Section: Argument Parsing #==============================================================================