Standardizing File Verifications
cli_checkFiles
The file verification tasks are implemented through
cli_checkFiles function inside the
centos-art.sh script. The
cli_checkFiles function is exported to
centos-art.sh script environment in the
very beginning of its execution and will be available all
along its execution lifetime. You can use this function inside
common and specific functions whenever you need to verify
files inside the &TCAR;.
The cli_checkFiles answers basic
questions like Does location
is a regular file?
and Does
location is directory?
.
When the answer to such questions is positive, the script
passes the test silently and continues its execution. When
the answer is negative, the script finishes its execution
immediately with an error message.
Use the cli_checkFiles function whenever
you need to verify the characteristics of different file types
(e.g., regular files, directories, links, etc.) inside &TCAR;.
Syntax
cli_checkFiles
-d
-e
-f
-h
-x
LOCATION
Options
The cli_checkFiles function accepts the
following options:
Verifies whether LOCATION exists
and is a directory. If it doesn't exists or isn't a directory,
an error message is printed and the script finishes its
execution. Otherwise, if it exists and is a directory, the
script continues its execution normally.
Verifies whether LOCATION exists or
not. If it doesn't exist, an error message is printed and the
script finishes its execution. Otherwise, if it does exists,
the script continues its execution normally.
Verifies whether LOCATION exists
and is a regular file. If it doesn't exists or isn't a regular
file, an error message is printed and the script finishes its
execution. Otherwise, if it exists and is a regular file, the
script continues its execution normally.
Verifies whether LOCATION exists
and is a symbolic link. If it doesn't exists or isn't a
symbolic link, an error message is printed and the script
finishes its execution immediately. Otherwise, if it does
exist and is a symbolic link, the script continue its
execution normally.
Verifies whether LOCATION exists
and execution permission is granted. If it doesn't exist or
hasn't execution permission, the script finishes its execution
immediately. Otherwise, if it exists and has execution
permissions, the script continues its execution normally.
The value of the LOCATION argument
must be an absolute path to the file you want to verify. If
such file doens't exists in any supported form, the script
finishes its execution with an error message.
Description
The cli_checkFiles function is available
inside the centos-art.sh script only as part of its execution
environment. This function is exported to centos-art.sh script
just after executing the script from the command-line and will
be available all along the script lifetime. So, you can use
this function both in common and specific functionalities of
centos-art.sh script.
The cli_checkFiles function doesn't
create subsequent execution environments.
Authors
Alain Reguera Delgado alain.reguera@gmail.com, =COPYRIGHT_YEAR_LIST=
License
Copyright © =COPYRIGHT_YEAR_LIST= The CentOS Project
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
USA.