Blame Scripts/Functions/cli_getFilesList.sh
|
|
b7b189 |
#!/bin/bash
|
|
|
b7b189 |
#
|
|
|
b7b189 |
# cli_getFilesList.sh -- This function defines the list of FILES to
|
|
|
b7b189 |
# process.
|
|
|
b7b189 |
#
|
|
|
2d3646 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
|
|
|
dcd347 |
|
|
|
dcd347 |
|
|
|
fa95b1 |
#
|
|
|
74a058 |
|
|
|
74a058 |
|
|
|
b7b189 |
|
|
|
b7b189 |
# General Public License for more details.
|
|
|
b7b189 |
#
|
|
|
b7b189 |
|
|
|
b7b189 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
b7b189 |
# ----------------------------------------------------------------------
|
|
|
b7b189 |
# $Id$
|
|
|
b7b189 |
# ----------------------------------------------------------------------
|
|
|
b7b189 |
|
|
|
b7b189 |
function cli_getFilesList {
|
|
|
b7b189 |
|
|
|
8eeb3a |
local LOCATION=''
|
|
|
f5c4be |
local FILTER=''
|
|
|
f5c4be |
local FILES=''
|
|
|
8eeb3a |
|
|
|
8eeb3a |
|
|
|
8eeb3a |
# default location. Otherwise, if first argument is not provided,
|
|
|
8eeb3a |
|
|
|
8eeb3a |
if [[ "$1" != '' ]];then
|
|
|
8eeb3a |
LOCATION="$1"
|
|
|
8eeb3a |
else
|
|
|
8eeb3a |
LOCATION="$ACTIONVAL"
|
|
|
8eeb3a |
fi
|
|
|
8eeb3a |
|
|
|
f5c4be |
|
|
|
f5c4be |
# default extension to look for files. Otherwise, if second
|
|
|
f5c4be |
|
|
|
f5c4be |
if [[ "$2" != '' ]];then
|
|
|
f5c4be |
FILTER="$2"
|
|
|
f5c4be |
else
|
|
|
f5c4be |
FILTER="$FLAG_FILTER"
|
|
|
f5c4be |
fi
|
|
|
f5c4be |
|
|
|
f5c4be |
|
|
|
f5c4be |
|
|
|
f5c4be |
|
|
|
4a9a32 |
|
|
|
f5c4be |
|
|
|
385cc4 |
|
|
|
f5c4be |
|
|
|
f5c4be |
|
|
|
385cc4 |
|
|
|
385cc4 |
|
|
|
385cc4 |
|
|
|
385cc4 |
|
|
|
385cc4 |
FILTER="^.+/${FILTER}$"
|
|
|
8eeb3a |
|
|
|
385cc4 |
# Define list of files to process. At this point we cannot verify
|
|
|
385cc4 |
|
|
|
385cc4 |
|
|
|
385cc4 |
# verifying exit status and go on.
|
|
|
385cc4 |
FILES=$(find ${LOCATION} -regextype posix-egrep -regex "${FILTER}" | sort | uniq)
|
|
|
8eeb3a |
|
|
|
d1225f |
|
|
|
385cc4 |
if [[ $? -eq 0 ]];then
|
|
|
385cc4 |
echo "$FILES"
|
|
|
385cc4 |
fi
|
|
|
b7b189 |
|
|
|
b7b189 |
}
|