From 173bcd41b12a212f1f7206d64fc95ff6b235f1e2 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 20 Apr 2021 07:29:30 +0200 Subject: [PATCH] Fixing lib/functions.rc --- lib/functions.rc | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) 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 -- 2.39.5