|
|
c0ee12 |
#!/bin/bash
|
|
|
c0ee12 |
#
|
|
|
4fac24 |
# shell.sh -- This function provides very basic string manipulations
|
|
|
4fac24 |
# to help you maintain Bash scripts inside repository.
|
|
|
c0ee12 |
#
|
|
|
7cd8e9 |
# Copyright (C) 2009, 2010 Alain Reguera Delgado
|
|
|
c0ee12 |
#
|
|
|
7cd8e9 |
# This program is free software; you can redistribute it and/or
|
|
|
7cd8e9 |
# modify it under the terms of the GNU General Public License as
|
|
|
7cd8e9 |
# published by the Free Software Foundation; either version 2 of the
|
|
|
7cd8e9 |
# License, or (at your option) any later version.
|
|
|
c0ee12 |
#
|
|
|
c0ee12 |
# This program is distributed in the hope that it will be useful, but
|
|
|
c0ee12 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
c0ee12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
c0ee12 |
# General Public License for more details.
|
|
|
c0ee12 |
#
|
|
|
c0ee12 |
# You should have received a copy of the GNU General Public License
|
|
|
c0ee12 |
# along with this program; if not, write to the Free Software
|
|
|
c0ee12 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
c0ee12 |
# USA.
|
|
|
c0ee12 |
#
|
|
|
c0ee12 |
# ----------------------------------------------------------------------
|
|
|
c0ee12 |
# $Id$
|
|
|
c0ee12 |
# ----------------------------------------------------------------------
|
|
|
c0ee12 |
|
|
|
4fac24 |
function shell {
|
|
|
c0ee12 |
|
|
|
c0ee12 |
local FILES=''
|
|
|
c0ee12 |
|
|
|
4fac24 |
# Define list of files to process using option value as reference.
|
|
|
c0ee12 |
if [[ -d $OPTIONVAL ]];then
|
|
|
754a35 |
FILES=$(find $OPTIONVAL -regextype posix-egrep -type f -regex "^${REGEX}\.sh$")
|
|
|
c0ee12 |
elif [[ -f $OPTIONVAL ]];then
|
|
|
c0ee12 |
FILES=$OPTIONVAL
|
|
|
c0ee12 |
fi
|
|
|
754a35 |
|
|
|
754a35 |
# Check list of files to process. If list of files is empty there
|
|
|
754a35 |
# is nothing to do except to print a message and end script
|
|
|
754a35 |
# execution.
|
|
|
754a35 |
if [[ $FILES == '' ]];then
|
|
|
754a35 |
cli_printMessage "`gettext "There is no file to process."`"
|
|
|
754a35 |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
754a35 |
fi
|
|
|
754a35 |
|
|
|
754a35 |
# Define command-line interface.
|
|
|
754a35 |
shell_getActions
|
|
|
c0ee12 |
|
|
|
c0ee12 |
}
|