-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave-galaxysquad.sh
executable file
·31 lines (28 loc) · 1.04 KB
/
save-galaxysquad.sh
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
#!/bin/zsh -
#===============================================================================
#
# FILE: save-galaxysquad.sh
#
# USAGE: ./save-galaxysquad.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Cláudio "Patola" Sampaio (Patola), [email protected]
# ORGANIZATION: MakerLinux
# CREATED: 25/07/2019 03:34:55 -03
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
ARGS="$@"
SAVEFILE="/home/patola/.config/unity3d/Oleg Kazakov/Galaxy Squad/saveData.txt"
COPYTO="/jogos/backup/galaxysquad/saves"
[[ ( "$SAVEFILE" -nt "$(ls -1trd "$COPYTO"/*/ | tail -1)/saveData.txt" ) && ( $(md5sum "$SAVEFILE") != $(md5sum "$(ls -1trd "$COPYTO"/*/ | tail -1)/saveData.txt" ) ) ]] && { # we got something new, back it up
data="$(date '+%Y%m%d%H%M')"
mkdir -p "$COPYTO"/"$data"
cp -p "$SAVEFILE" "$COPYTO"/"$data"/
}
exec "$ARGS"