New exep function which handels pipes and redirects properly

rework mayan backup and restore steps
This commit is contained in:
2019-05-26 03:02:12 +02:00
parent ab10ef6504
commit 48f6de3026
2 changed files with 25 additions and 3 deletions

View File

@@ -365,7 +365,7 @@ showVersion() {
}
exe() {
arr=("$@")
local arr=("$@")
if [ $DRY -ne 0 ] ; then
echo -e "\n-- ${arr[@]}"
elif [ $VERBOSE -eq 1 ] ; then
@@ -375,6 +375,18 @@ exe() {
fi
}
# Handle dry run and verbose output for commands containing pipe and/or redirects
# exep <COMMAND TO RUN AS STRING>
exep() {
if [ $DRY -ne 0 ] || [ $VERBOSE -eq 1 ] ; then
echo -e "\n-- $1"
fi
if [ $DRY -eq 0 ] ; then
bash -c "$1"
fi
}
main() {
local START=0