tunuifranken.info/bin/pull-cours.sh

24 lines
482 B
Bash
Executable file

#!/bin/bash
# This script is executed by make in the parent directory
main() {
verbose -n "Pulling cours... "
origin_file_time=$(stat -c %Y ~/lessons/cours-info/cours*.pdf)
current_file_time=$(stat -c %Y ./cours.pdf)
if [ "$origin_file_time" -gt "$current_file_time" ]; then
cp ~/lessons/cours-info/cours*.pdf ./cours.pdf && echo "Updated cours"
else
verbose "Already up to date"
fi
}
verbose() {
if [ "$VERBOSE" = true ]; then
echo "$@"
fi
}
main