From fb21924922aece6b197165cf09e3a40b15fb4dbf Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 21 Jan 2020 14:52:49 +0100 Subject: watch-calendars: do not cd --- watch-calendars | 17 ++++++----------- 1 file 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 -- cgit v1.2.3-70-g09d2