summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xwatch-calendars17
1 files changed, 6 insertions, 11 deletions
diff --git a/watch-calendars b/watch-calendars
index cbae9be..e55e6b8 100755
--- a/watch-calendars
+++ b/watch-calendars
@@ -9,17 +9,12 @@ if [ $# -eq 0 ]; then
exit $?
fi
-dir=$(
- readlink -e "$1"
-)
-
-cd "${dir}" || exit $?
-
-while [ -d "${dir}" ]; do
- inotifywait -r . -e CREATE,MOVED_TO -t 30
+while [ -d "$1" ]; do
+ inotifywait -r "$1" -e CREATE,MOVED_TO -t 30
if [ $? -eq 0 ]; then
- git commit -am'update by '"$(whoami)"'@'"$(hostname)"' on '"$(date)"
+ git -C "$1" add .
+ git -C "$1" commit -m'update by '"$(whoami)"'@'"$(hostname)"' on '"$(date)"
fi
- git pull --rebase
- git push
+ git -C "$1" pull --rebase
+ git -C "$1" push
done