init I
This commit is contained in:
1
000_CaH_Tests/last_change
Normal file
1
000_CaH_Tests/last_change
Normal file
@@ -0,0 +1 @@
|
||||
2020-03-19 14:37:28.484385089k
|
||||
42
000_CaH_Tests/test1.sh
Normal file
42
000_CaH_Tests/test1.sh
Normal 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
|
||||
1
000_CaH_Tests/test2.sh
Normal file
1
000_CaH_Tests/test2.sh
Normal file
@@ -0,0 +1 @@
|
||||
hallo
|
||||
1
000_CaH_Tests/testfile
Normal file
1
000_CaH_Tests/testfile
Normal file
@@ -0,0 +1 @@
|
||||
jjj
|
||||
Reference in New Issue
Block a user