Blame Scripts/Bash/Functions/Prepare/prepare_getEnvars.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# prepare_getEnvars.sh -- This function outputs a brief description of
878a2b
# relevant environment variables used by `centos-art.sh' script.
878a2b
#
03486a
# Copyright (C) 2009, 2010, 2011, 2012 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 prepare_getEnvars {
878a2b
878a2b
    local -a VARS
878a2b
    local -a INFO
878a2b
    local COUNT=0
878a2b
878a2b
    # Define name of environment variables used by centos-art.sh
878a2b
    # script.
878a2b
    VARS[0]='EDITOR'
878a2b
    VARS[1]='TZ'
878a2b
    VARS[2]='TEXTDOMAIN'
878a2b
    VARS[3]='TEXTDOMAINDIR'
878a2b
    VARS[4]='LANG'
878a2b
878a2b
    # Define description of environment variables.
878a2b
    INFO[0]="`gettext "Default text editor"`"
878a2b
    INFO[1]="`gettext "Default time zone representation"`"
878a2b
    INFO[2]="`gettext "Default domain used to retrieve translated messages"`"
878a2b
    INFO[3]="`gettext "Default directory used to retrive translated messages"`"
878a2b
    INFO[4]="`gettext "Default locale information"`"
878a2b
878a2b
    until [[ $COUNT -eq ${#VARS[*]} ]];do
878a2b
878a2b
        # Let user to reduce output using regular expression as
878a2b
        # reference.
878a2b
        if [[ ${VARS[$COUNT]} =~ $FLAG_FILTER ]];then
878a2b
878a2b
            # Output list of environment variables using indirect
878a2b
            # expansion (what a beautiful feature!) to output variable
878a2b
            # value.
878a2b
            cli_printMessage "${INFO[$COUNT]}:"
878a2b
            cli_printMessage "${VARS[$COUNT]}=${!VARS[$COUNT]}" --as-response-line
878a2b
878a2b
        fi
878a2b
878a2b
        # Increment counter.
878a2b
        COUNT=$(($COUNT + 1))
878a2b
878a2b
    done
878a2b
878a2b
}