1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/bin/sh
# vim: set filetype=sh :
# file: test.rename_logfile
# copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2007-2020)
# license: GNU General Public License, version 3
# description: test using shell script functions
# see also: example.rename_logfile
# The following tests are included:
# (1) Run this script
# (2) check the logfile
. ./tstlib
shell=""
while [ $# -ne 0 ]; do
if [ "$1" = "-s" ]; then
shell="$2"
shift 2
else
echo "ERROR $0: unknown option <$1>" >&2
exit 1
fi
done
cmd=$(dirname $0)/example.rename_logfile
log1="$(mktemp)"
log2="$(mktemp)"
check "(1) Run this script" "$@" "$cmd $log1 $log2" \
"using first logfile $log1
using real logfile $log2"
check "(2) check the logfile" "$@" "cat $log2" \
"|using first logfile $log1
|using real logfile $log2"
rm -f $log1
rm -f $log2
|