Last active
August 20, 2023 21:07
-
-
Save dewomser/e8fd35b249667f4912cb21de4753c188 to your computer and use it in GitHub Desktop.
File last modified today? Bashscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the last modification time of the file in seconds | |
last_modified=$(stat -c "%Y" $file) | |
# Read the previous value from ~/temp/letzter.txt | |
previous_modified=$(cat ~/temp/letzter.txt) | |
# Compare the last and previous values | |
if [ $last_modified -gt $previous_modified ]; then | |
echo "The file has changed" | |
else | |
echo "The file has not changed" | |
fi | |
# Write the last value to ~/temp/letzter.txt | |
echo $last_modified > ~/temp/letzter.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Löok if there is an update for $test available today | |
test=https://lua.rlp.de/fileadmin/lua/Downloads/Corona/Listen/Fallzahlen_und_Todesfaelle_Corona_RLP.xlsx | |
codate1=$(curl -sI $test | grep -i 'Last-Modified:'|grep -E -o "[0-9]{2}[[:blank:]][[:alpha:]]{3}[[:blank:]][0-9]{4}") | |
date1=$(LC_ALL=C date '+%d %b %Y' -u) | |
#echo $codate1 $date1 | |
if [[ "$date1" = "$codate1" ]] | |
then | |
echo "file is modified today" | |
else | |
echo "file is NOT modified today" | |
# sleep 10 | |
exit | |
fi |
changed language from german to something like english
sleep 10 not necessary
Do not know wether modified_by_Bingchat.sh works. But looks good.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is better now