You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
637 B
26 lines
637 B
has_class() {
|
|
if [ 1 -ne $# ]
|
|
then
|
|
logger -p syslog.err 'has_class: no class given'
|
|
exit 1
|
|
fi
|
|
|
|
local CHECK=" ${CLASSES}"
|
|
test "${CHECK}" != "${CHECK% ${1} *}"
|
|
}
|
|
|
|
##
|
|
# add one or more classes given as arguments to this function
|
|
# Using ${@} here effectively eliminates multiple spaces between
|
|
# the classnames.
|
|
# A class might be defined multiple times...I don't eliminate these
|
|
# duplicates as this might involve calling uniq which is unneccesary
|
|
# overhead as I see no harm in duplicates now.
|
|
#
|
|
set_class() {
|
|
[ -z "${CLASSES}" ] &&
|
|
{ CLASSES="${@}"; export CLASSES; } ||
|
|
CLASSES="${CLASSES} ${@}"
|
|
}
|
|
|
|
# vim: set ts=4 sw=4:
|