diff --git a/bin/sudoedit b/bin/sudoedit index 4ef3a58..60265e1 100755 --- a/bin/sudoedit +++ b/bin/sudoedit @@ -1,8 +1,12 @@ #!/bin/zsh tmp="$(mktemp /tmp/sudoedit_XXXXXXXXXXXX_$(basename $1))" +touch "$tmp" + +if [ -f "$1" ]; then + sudo cat "$1" > "$tmp" +fi -sudo cat "$1" > "$tmp" inotifywait -m "$tmp" -e create -e moved_to -e close_write 2>/dev/null > \ >(sudo sh -c "while read path action file; do cp '$tmp' '$1'; done") &