diff options
-rw-r--r-- | TODO | 3 | ||||
-rwxr-xr-x | rsync-backup | 13 |
2 files changed, 9 insertions, 7 deletions
@@ -1,7 +1,4 @@ # -- BUGS -- # -- $1 == /path/, where /path is configured behaves strangely. - `- $1 == /path is fine. - `- A backup is created in $PWD/ # -- TODO -- # - For ssh, set up one single connection (maybe configurable?). diff --git a/rsync-backup b/rsync-backup index e0ed37a..0a7df33 100755 --- a/rsync-backup +++ b/rsync-backup @@ -2,7 +2,7 @@ # # rsync-backup - a backup script using rsync. # -# Copyright 2015 - 2018 Einhard Leichtfuß +# Copyright 2015 - 2019 Einhard Leichtfuß # # This file is part of rsync-backup. # @@ -38,7 +38,8 @@ typeset -r DATEFMT='%Y-%m-%d_%H%M%S' # Shell options: # nullglob: In case of a non-matching glob, return nothing. # dotglob: Include dotfiles (except . and ..) in glob matching. -typeset -r SHOPTS='nullglob dotglob' +typeset -r SHOPTS='dotglob' +typeset -r SHOPTS_AFTER_GET_ARGS='nullglob' # Global program variables. @@ -108,6 +109,8 @@ function main # Set $src, $dest_path and $filter_args. get_args "$@" || return $? + shopt -s $SHOPTS_AFTER_GET_ARGS + # Verify $src_path exists. run_function "$src_host" src_check_path '' 'src_path src' || return $? @@ -144,6 +147,8 @@ function main # # $@: command line parameters # +# requires the shell option nullglob to be _unset_. (for test -v to work) +# function get_args { if [ $# -eq 0 ] @@ -161,7 +166,7 @@ function get_args if [ $# -gt 1 ] then l_dest="$2" - elif test -v bakpath[$src] + elif test -v bakpath[$src] # $# -eq 1 then l_dest="${bakpath[$src]}" else @@ -261,7 +266,7 @@ function resolve_host_path # $1: host: name # $2: function to run: name # $3: other functions to export: [name (. ' ' . name)*] -# $4: variables to export: [name (. ' ' . name)*] +# $4: variables to export: [name (. '[@]')? (. ' ' . name (. '[@]')?)*] # ${@:5}: function arguments: string+ # function run_function |