From 0cded7c8880521c8bcad9e58e6eeb57b236fa1fe Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Mon, 13 Jan 2020 18:12:02 +0100 Subject: [PATCH] Advanced help output showing actual paths before step start --- seqs/backup.sh | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/seqs/backup.sh b/seqs/backup.sh index 702b90a..f331e6e 100755 --- a/seqs/backup.sh +++ b/seqs/backup.sh @@ -40,10 +40,38 @@ step_1() { } step_3_info() { - echo "Backup [OPTION] [EXCLUDES...]" - echoinfo "Exclude path notation starts within DIRECTORY." - echoinfo "e.g. to exclude DIRECTORY/a:" - echoinfo " $0 budir DIRECTORY TARGET /a" + # Backup single directory recursively + local opt="[OPTION]" + local dir="" + local tar="" + local exc="[EXCLUDES...]" + shift + if [ "$1" == "-t" ] ; then + opt=" -t " + tar= + shift + fi + if [ ! -z "$1" ] ; then + dir="$1" + shift + if [ ! -z $tar ] && [ ! -z "$1" ] ; then + tar="$1" + shift + else + tar="$BACKUP_TARGET" + fi + if [ ! -z "$1" ] ; then + exc="$@" + else + exc="[NO EXCLUDES]" + fi + fi + echo "Backup $opt $dir $tar $exc" + echoinfo " -t : Using configuration value as TARGET" + echoinfo " [EXCLUDES...]" + echoinfo "EXCLUDES path notation starts within $dir" + echoinfo "e.g. to exclude $dir/a:" + echoinfo " $0 budir $dir $tar /a" } step_3_alias() { ALIAS="budir"; } step_3() {