Created
November 30, 2017 18:32
-
-
Save ahebrank/7cf353d1fb1a52e3c5735adf8de13d3f to your computer and use it in GitHub Desktop.
mirror files from one place to another while you're working on them (e.g., plugin development with live testing on a site using it)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| CMD="notifyloop" | |
| function show_help() { | |
| echo "$0 [SRC] DEST" | |
| echo " SRC and DEST are anything recognizable to rsync" | |
| echo " if unspecified, SRC is pwd" | |
| } | |
| command -v $CMD >/dev/null 2>&1 || { | |
| echo >&2 "I require notifyloop but it's not installed. Try 'brew install fsevents-tools'." | |
| exit 1 | |
| } | |
| if [ $# -eq 2 ]; then | |
| SRC=$1 | |
| DEST=$2 | |
| elif [ $# -eq 1 ]; then | |
| SRC="$( pwd )/" | |
| DEST=$1 | |
| else | |
| show_help | |
| exit 1 | |
| fi | |
| echo "Syncing $SRC to $DEST. Control-c to break." | |
| notifyloop . rsync -avz --exclude=".git" $SRC $DEST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment