From 07fcd285456da5bed436b8fff310c44367724219 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Mon, 9 Dec 2019 23:37:26 +0100 Subject: [PATCH] Bump sequencer version to 7.1.0 Update verbose and dry-run handling. Using bash ":" build-in function Small helpapi update --- sequencer/sequencer.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/sequencer/sequencer.sh b/sequencer/sequencer.sh index 7e7a3de..d945474 100755 --- a/sequencer/sequencer.sh +++ b/sequencer/sequencer.sh @@ -7,7 +7,7 @@ ## Version information VERSION_REV=7 -VERSION_MAJOR=0 +VERSION_MAJOR=1 VERSION_MINOR=0 ## Start of generic script part @@ -61,7 +61,9 @@ helpApi() { echo echo " exep \"[COMMANDLINE]\"" echo " See exe, but support for pipes or redirects." - echo " Since the command line is given as string all apostrophes need to be esacped." + echo " Important:" + echo " - Shell commands cd, read, ... won't work because COMMANDLINE is started in a new shell." + echo " - All apostrophes need to be esacped since the command line is given as string." echo echo " addConf " echo " Trying to write or append to a file." @@ -97,12 +99,15 @@ helpApi() { echo " getReturn" echo " Return last saved error code" echo - echo " endReturn [-f] [-o ERRORCODE] [MESSAGE]" + echo " endReturn [OPTIONS] [MESSAGE]" echo " Notifys user that there was an error (previously saved by saveReturn," echo " or -o [ERRORCODE]) and asks to continue or end the sequence." echo " Always exits with evaluated error code." - echo " -f : force exit without user input, if error code is not 0" - echo " -o : override stored error code and check ERRORCODE" + echo " [OPTIONS]" + echo " -f : force exit without user input, if error code is not 0" + echo " -o ERRORCODE : override stored error code and check ERRORCODE" + echo " [MESSAGE]" + echo " String which is displayed in the error output" echo } @@ -557,10 +562,13 @@ showVersion() { exe() { local arr=("$@") if [ $DRY -ne 0 ] ; then - echo "-- ${arr[@]}" - elif [ $VERBOSE -eq 1 ] ; then - (set -x; "${arr[@]}") - else + echo -n "--" + fi + if [ $DRY -ne 0 ] || [ $VERBOSE -eq 1 ] ; then + (set -x; : "${arr[@]}") + fi + + if [ $DRY -eq 0 ] ; then "${arr[@]}" fi } @@ -569,9 +577,9 @@ exe() { # exep exep() { if [ $DRY -ne 0 ] ; then - echo "-- $1" + echo "--++ : $1" elif [ $VERBOSE -eq 1 ] ; then - echo "++ $1" + echo "++ : $1" fi if [ $DRY -eq 0 ] ; then