This commit is contained in:
2024-10-13 23:27:09 +02:00
commit 30627b25b3
48 changed files with 1919 additions and 0 deletions

42
000_CaH_Tests/test1.sh Normal file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
# Scripts checks whether 'testfile' has been modified and prints result
# File 'last_change' contains last saved modification date-time of 'testfile'
# and gets updated if 'stat testfile' shows a different modification date
# stdin stdout stderr
DIR=`dirname $0` > /dev/null
pushd $DIR > /dev/null
# file 'testfile' not a regular file? exit with error
if [ ! -f testfile ]
then
echo "Datei nicht gefunden"
echo "Ende mit Fehlercode 1"
popd > /dev/null
exit 1
fi
# File 'testfile' found
# get 'testfile' modified date-time
modified=`stat testfile | grep -i modi | awk -F' ' '{ print $2 " " $3 }'`
# get date-time from change before
last_modified=`cat last_change`
# ` Backtick
# if both date-time equal no change!
if [ "$modified" == "$last_modified" ]
then
echo "Datei nicht modifiziert!"
else
# not equal: file changed
echo "Datei modifiziert!"
# save last modified
echo "$modified" > last_change
fi
popd > /dev/null
exit 0