From 97ff1ce0a12ba1018a81ca873a1e63a2049304cd Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Mon, 18 Mar 2024 18:40:21 +0000 Subject: [PATCH 1/1] feat(user/rsync_tranches):Handle option args - Note: Handle by assuming non-paths are option args --- user/rsync_tranches.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/user/rsync_tranches.sh b/user/rsync_tranches.sh index 0456daa..eed19f6 100644 --- a/user/rsync_tranches.sh +++ b/user/rsync_tranches.sh @@ -7,7 +7,7 @@ function rsync_tranches() { # Desc: Runs rsync in parallel across different files size ranges # Example: rsync_tranches -avu --progress --dry-run ./SOURCE/ ./DEST/ # Depends: rsync 3.2.7 - # Version: 0.0.3 + # Version: 0.1.0 local -a rsync_opts=(); local source dest; @@ -20,7 +20,13 @@ function rsync_tranches() { shift; ;; *) - if [ -z "$source" ]; then + ## If not a file or directory, assume option + if [[ ! -f "$1" ]] && [[ ! -d "$1" ]]; then + rsync_opts+=("$1"); + shift; + fi; + ## If valid file or directory, assume source or dest path + if [[ -z "$source" ]]; then source="$1"; else dest="$1"; -- 2.30.2