}
+#------------------------------------------------------------------------------
+eval_my_options() {
+
+ REMAINING_ARGS=()
+ REMAINING_OPTS=()
+
+ if [[ "$#" -gt 0 ]] ; then
+ while true ; do
+ case "$1" in
+ -C|--copies)
+ BACKUP_COPIES="$2"
+ REMOVE_DATE=$(date -d "${BACKUP_COPIES} days ago" +"%Y-%m-%d")
+ shift
+ shift
+ ;;
+ -R|--remote)
+ REMOTE_HOSTS+=("${2}")
+ shift
+ shift
+ ;;
+ --) shift
+ break
+ ;;
+ *) REMAINING_OPTS+=($1)
+ shift
+ ;;
+ esac
+ done
+ fi
+
+ if [[ "$#" -gt "0" ]] ; then
+ REMAINING_ARGS=("--")
+ while [[ "$#" -gt "0" ]] ; do
+ REMAINING_ARGS+=($1)
+ shift
+ done
+ fi
+
+ debug "Keeping backup copies: ${CYAN}${BACKUP_COPIES}${NORMAL}"
+ debug "Separation date: '${CYAN}${REMOVE_DATE}${NORMAL}'."
+ if [[ "${#REMOTE_HOSTS[*]}" == "0" ]] ; then
+ debug "No remote host for mirroring given."
+ else
+ debug "Remote hosts for mirroring: ${CYAN}${REMOTE_HOSTS[*]}"
+ fi
+
+}
+
#------------------------------------------------------------------------------
get_options() {
declare -p REMAINING_ARGS
fi
+ eval_my_options "${REMAINING_OPTS[@]}" -- "${REMAINING_ARGS[@]}"
+
if [[ "${#REMAINING_OPTS[@]}" -gt 0 ]] ; then
error "Unknown options: ${REMAINING_OPTS[*]}"
echo >&2