From c24772cd31772fb7de2b5eb3bcb153c9c9b79cc8 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 19 Apr 2021 12:32:32 +0200 Subject: [PATCH] Changing some functions --- lib/functions.rc | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/lib/functions.rc b/lib/functions.rc index 43edcc6..657003e 100644 --- a/lib/functions.rc +++ b/lib/functions.rc @@ -348,10 +348,15 @@ purge() { #------------------------------------------------------------------------------ CP() { + local cmd="cp $*" + if [[ "${VERBOSE}" != "y" ]] ; then + cmd="cp --verbose $*" + fi if [[ "${SIMULATE}" == "y" ]] ; then - debug "Simulated copying of: $*" + info "Executing: ${cmd}" return fi + debug "Executing: ${cmd}" if [[ "${VERBOSE}" != "y" ]] ; then cp "$@" else @@ -363,10 +368,15 @@ CP() { #------------------------------------------------------------------------------ MV() { + local cmd="mv $*" + if [[ "${VERBOSE}" != "y" ]] ; then + cmd="mv --verbose $*" + fi if [[ "${SIMULATE}" == "y" ]] ; then - debug "Simulated moving of: $*" + info "Executing: ${cmd}" return fi + debug "Executing: ${cmd}" if [[ "${VERBOSE}" != "y" ]] ; then mv "$@" else @@ -378,10 +388,15 @@ MV() { #------------------------------------------------------------------------------ CHOWN() { + local cmd="chown $*" + if [[ "${VERBOSE}" != "y" ]] ; then + cmd="chown --verbose $*" + fi if [[ "${SIMULATE}" == "y" ]] ; then - debug "Simulated chowning of $*" + info "Executing: ${cmd}" return fi + debug "Executing: ${cmd}" if [[ "${VERBOSE}" != "y" ]] ; then chown "$@" else @@ -390,13 +405,38 @@ CHOWN() { } +#------------------------------------------------------------------------------ +CHMOD() { + + local cmd="chmod $*" + if [[ "${VERBOSE}" != "y" ]] ; then + cmd="chmod --verbose $*" + fi + if [[ "${SIMULATE}" == "y" ]] ; then + info "Executing: ${cmd}" + return + fi + debug "Executing: ${cmd}" + if [[ "${VERBOSE}" != "y" ]] ; then + chmod "$@" + else + chmod --verbose "$@" + fi + +} + #------------------------------------------------------------------------------ LN() { + local cmd="ln $*" + if [[ "${VERBOSE}" != "y" ]] ; then + cmd="ln --verbose $*" + fi if [[ "${SIMULATE}" == "y" ]] ; then - debug "Simulating: ln $*" + info "Executing: ${cmd}" return fi + debug "Executing: ${cmd}" if [[ "${VERBOSE}" != "y" ]] ; then ln "$@" else -- 2.39.5