support multiple shell arguments (e.g. -v -q)
new verbose output (-v) to echo commands called with exe() before execution
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
step_1_info() { echo "Step $1 header"; }
|
step_1_info() { echo "Step $1 header"; }
|
||||||
step_1_alias() { ALIAS="begin"; }
|
step_1_alias() { ALIAS="begin"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
cat .nofile
|
exe cat '.no f"le'
|
||||||
saveReturn $?
|
saveReturn $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,6 +13,7 @@ VERSION_MINOR=0
|
|||||||
## Start of generic script part
|
## Start of generic script part
|
||||||
|
|
||||||
QUIET=0
|
QUIET=0
|
||||||
|
VERBOSE=0
|
||||||
ERNO=0
|
ERNO=0
|
||||||
MAX_STEP=255
|
MAX_STEP=255
|
||||||
ALIAS=
|
ALIAS=
|
||||||
@@ -27,7 +28,9 @@ helpSequencer() {
|
|||||||
echo " --help, -h : Display help"
|
echo " --help, -h : Display help"
|
||||||
echo " --quiet, -q : Don't ask for permission to execute steps"
|
echo " --quiet, -q : Don't ask for permission to execute steps"
|
||||||
echo " If called without starting step number, only this help is shown"
|
echo " If called without starting step number, only this help is shown"
|
||||||
echo " --version,-v : Display version of sequencer and revision of sequence"
|
echo " --verbose, -v : Verbose output (use exe() function to call shell commands in seqs)"
|
||||||
|
echo " ( e.g.: exe apt update )"
|
||||||
|
echo " --version : Display version of sequencer and revision of sequence"
|
||||||
echo
|
echo
|
||||||
echo " [STEP NUMBER(s) 1-${MAX_STEP} or ALIAS]"
|
echo " [STEP NUMBER(s) 1-${MAX_STEP} or ALIAS]"
|
||||||
echo " Single STEP or ALIAS : starting point of process"
|
echo " Single STEP or ALIAS : starting point of process"
|
||||||
@@ -331,11 +334,21 @@ showVersion() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exe() {
|
||||||
|
arr=("$@")
|
||||||
|
if [ $VERBOSE -eq 1 ] ; then
|
||||||
|
(set -x; "${arr[@]}")
|
||||||
|
else
|
||||||
|
"${arr[@]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
local START=0
|
local START=0
|
||||||
|
|
||||||
# option check
|
# options check
|
||||||
case "$1" in
|
for arg in "$@" ; do
|
||||||
|
case "$arg" in
|
||||||
--help|-h) # show only help
|
--help|-h) # show only help
|
||||||
displayHelp
|
displayHelp
|
||||||
exit 0;
|
exit 0;
|
||||||
@@ -344,16 +357,23 @@ main() {
|
|||||||
QUIET=1
|
QUIET=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--version|-v) # version request
|
--verbose|-v) # set verbose flag
|
||||||
|
VERBOSE=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--version) # version request
|
||||||
showVersion
|
showVersion
|
||||||
exit 0;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
"") # Empty -> show help
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z $1 ] || [ "$1" == "" ] ; then
|
||||||
|
# Empty -> show help
|
||||||
displayHelp
|
displayHelp
|
||||||
# Assume starting at one for interactive mode
|
# Assume starting at one for interactive mode
|
||||||
START=1
|
START=1
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
|
|
||||||
# compatibility check of sequence
|
# compatibility check of sequence
|
||||||
if [ ! -z $VERSION_SEQREV ] && [ $VERSION_SEQREV -gt $VERSION_REV ] ; then
|
if [ ! -z $VERSION_SEQREV ] && [ $VERSION_SEQREV -gt $VERSION_REV ] ; then
|
||||||
|
Reference in New Issue
Block a user