How to wrap a multiple options string in zsh
Slight variation based on assumption there aren't any other commands or variable assignments in the current rsync_basic_options.sh
file:
$ cat rsync_basic_options
-aHSv
--progress
--force
--append-verify
There are then a few options for loading these into an array; a couple that come to mind:
$ ro=( $(< rsync_basic_options) ) # might be problematic if dealing with embedded white space
# or
$ mapfile -t ro < rsync_basic_options
Both of these populate the ro[]
array with the following:
$ typeset -p ro
declare -a ro=([0]="-aHSv" [1]="--progress" [2]="--force" [3]="--append-verify")
Which can then be used in the script like such:
rsync "${ro[@]}" "$source/" "$target/"