diff --git a/Rsync/rsync.sh b/Rsync/rsync.sh index 9ca885f..9632c70 100644 --- a/Rsync/rsync.sh +++ b/Rsync/rsync.sh @@ -24,14 +24,22 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/../Master.conf" source "$SCRIPT_DIR/../common.sh" -# ----------------------------- Input ----------------------------- -DIRECTORY="$1" +# ---------------------------- +# INPUT HANDLING (FIXED) +# ---------------------------- + +# If first argument is NOT a flag or VAR=VALUE, treat it as DIRECTORY if [[ -z "$DIRECTORY" ]]; then - echo "Usage: $0 [--dry-run] [VAR=value ...]" + if [[ "${1:-}" != "" && "${1:-}" != --* && "${1:-}" != *=* ]]; then + DIRECTORY="$1" + shift + fi +fi + +if [[ -z "$DIRECTORY" ]]; then + echo "Usage: $0 [--dry-run] [--status] [VAR=value ...]" exit 1 fi -shift -parse_args "$@" # ----------------------------- Host & IP ----------------------------- detect_hosts