From: Frank Brehm Date: Tue, 20 Apr 2021 05:29:30 +0000 (+0200) Subject: Fixing lib/functions.rc X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=173bcd41b12a212f1f7206d64fc95ff6b235f1e2;p=pixelpark%2Fadmin-tools.git Fixing lib/functions.rc --- diff --git a/lib/functions.rc b/lib/functions.rc index 657003e..7b5c27c 100644 --- a/lib/functions.rc +++ b/lib/functions.rc @@ -322,10 +322,15 @@ error() { #------------------------------------------------------------------------------ RM() { + local cmd="rm $*" + if [[ "${VERBOSE}" == "y" ]] ; then + cmd="rm --verbose $*" + fi if [[ "${SIMULATE}" == "y" ]] ; then - debug "Simulated removing of: $*" + info "Executing: ${cmd}" return fi + debug "Executing: ${cmd}" if [[ "${VERBOSE}" != "y" ]] ; then rm "$@" else @@ -345,11 +350,26 @@ purge() { } +#------------------------------------------------------------------------------ +MKDIR() { + + local cmd="mkdir $*" + if [[ "${VERBOSE}" == "y" ]] ; then + cmd="mkdir --verbose $*" + fi + if [[ "${SIMULATE}" == "y" ]] ; then + info "Executing: ${cmd}" + return + fi + debug "Executing: ${cmd}" + eval ${cmd} +} + #------------------------------------------------------------------------------ CP() { local cmd="cp $*" - if [[ "${VERBOSE}" != "y" ]] ; then + if [[ "${VERBOSE}" == "y" ]] ; then cmd="cp --verbose $*" fi if [[ "${SIMULATE}" == "y" ]] ; then @@ -369,7 +389,7 @@ CP() { MV() { local cmd="mv $*" - if [[ "${VERBOSE}" != "y" ]] ; then + if [[ "${VERBOSE}" == "y" ]] ; then cmd="mv --verbose $*" fi if [[ "${SIMULATE}" == "y" ]] ; then @@ -389,7 +409,7 @@ MV() { CHOWN() { local cmd="chown $*" - if [[ "${VERBOSE}" != "y" ]] ; then + if [[ "${VERBOSE}" == "y" ]] ; then cmd="chown --verbose $*" fi if [[ "${SIMULATE}" == "y" ]] ; then @@ -409,7 +429,7 @@ CHOWN() { CHMOD() { local cmd="chmod $*" - if [[ "${VERBOSE}" != "y" ]] ; then + if [[ "${VERBOSE}" == "y" ]] ; then cmd="chmod --verbose $*" fi if [[ "${SIMULATE}" == "y" ]] ; then @@ -429,7 +449,7 @@ CHMOD() { LN() { local cmd="ln $*" - if [[ "${VERBOSE}" != "y" ]] ; then + if [[ "${VERBOSE}" == "y" ]] ; then cmd="ln --verbose $*" fi if [[ "${SIMULATE}" == "y" ]] ; then