Blame Scripts/Functions/cli_doParseArguments.sh

b7b189
#!/bin/bash
b7b189
#
f4da7e
# cli_doParseArguments.sh -- This function redefines arguments
f4da7e
# (ARGUMENTS) global variable using getopt(1) output.
b7b189
#
073c6f
# Copyright (C) 2009-2011 Alain Reguera Delgado
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
fa95b1
# the Free Software Foundation; either version 2 of the License, or
fa95b1
# (at your option) any later version.
fa95b1
#
b7b189
# This program is distributed in the hope that it will be useful, but
b7b189
# WITHOUT ANY WARRANTY; without even the implied warranty of
b7b189
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b7b189
# General Public License for more details.
b7b189
#
b7b189
# You should have received a copy of the GNU General Public License
b7b189
# along with this program; if not, write to the Free Software
b7b189
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
b7b189
# USA.
b7b189
# ----------------------------------------------------------------------
9aebad
# $Id$
b7b189
# ----------------------------------------------------------------------
b7b189
b7b189
function cli_doParseArguments {
b7b189
b7b189
    # Reset positional parameters using optional arguments.
b7b189
    eval set -- "$ARGUMENTS"
b7b189
b7b189
    # Parse optional arguments using getopt.
7b46a4
    ARGUMENTS=$(getopt -o "$ARGSS" -l "$ARGSL" -n $CLI_PROGRAM -- "$@")
b7b189
b7b189
    # Be sure getout parsed arguments successfully.
b7b189
    if [[ $? != 0 ]]; then 
eee226
        cli_printMessage "${FUNCDIRNAM}" 'AsToKnowMoreLine'
b7b189
    fi
b7b189
b7b189
}