|
|
878a2b |
#!/bin/bash
|
|
|
878a2b |
#
|
|
|
878a2b |
# cli_parseArgumentsReDef.sh -- This function initiates/reset and
|
|
|
55ae84 |
# sanitizes positional parameters passed to this function and creates
|
|
|
55ae84 |
# the list of arguments that getopt will process.
|
|
|
878a2b |
#
|
|
|
e6bbbf |
# Copyright (C) 2009-2013 The CentOS Project
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is free software; you can redistribute it and/or modify
|
|
|
878a2b |
# it under the terms of the GNU General Public License as published by
|
|
|
878a2b |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
878a2b |
# your option) any later version.
|
|
|
878a2b |
#
|
|
|
878a2b |
# This program is distributed in the hope that it will be useful, but
|
|
|
878a2b |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
878a2b |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
878a2b |
# General Public License for more details.
|
|
|
878a2b |
#
|
|
|
878a2b |
# You should have received a copy of the GNU General Public License
|
|
|
878a2b |
# along with this program; if not, write to the Free Software
|
|
|
878a2b |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
878a2b |
#
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
# $Id$
|
|
|
878a2b |
# ----------------------------------------------------------------------
|
|
|
878a2b |
|
|
|
878a2b |
function cli_parseArgumentsReDef {
|
|
|
878a2b |
|
|
|
878a2b |
local ARG
|
|
|
878a2b |
|
|
|
878a2b |
# Clean up arguments global variable.
|
|
|
878a2b |
ARGUMENTS=''
|
|
|
878a2b |
|
|
|
878a2b |
# Fill up arguments global variable with current positional
|
|
|
878a2b |
# parameter information. To avoid interpretation problems, use
|
|
|
878a2b |
# single quotes to enclose each argument (ARG) from command-line
|
|
|
123ee8 |
# individually.
|
|
|
878a2b |
for ARG in "$@"; do
|
|
|
878a2b |
|
|
|
e6186a |
# Remove any single quote from arguments passed to
|
|
|
e6186a |
# centos-art.sh script. We will use single quotes for grouping
|
|
|
e6186a |
# option values so white space can be passed through them.
|
|
|
e6186a |
ARG=$(echo "$ARG" | tr -d "'")
|
|
|
878a2b |
|
|
|
123ee8 |
# Concatenate arguments and enclose them to let getopt to
|
|
|
878a2b |
# process them when they have spaces inside.
|
|
|
878a2b |
ARGUMENTS="$ARGUMENTS '$ARG'"
|
|
|
878a2b |
|
|
|
878a2b |
done
|
|
|
878a2b |
|
|
|
e6186a |
# Verify non-option arguments passed to command-line. If there
|
|
|
123ee8 |
# isn't any or dot is provided, redefine the ARGUMENTS variable to
|
|
|
123ee8 |
# use the current location the centos-art.sh script was called
|
|
|
123ee8 |
# from.
|
|
|
123ee8 |
if [[ -z $ARGUMENTS ]];then
|
|
|
e6186a |
ARGUMENTS=${PWD}
|
|
|
e6186a |
fi
|
|
|
e6186a |
|
|
|
878a2b |
}
|