From 4910216ec2d52819b10318fd2efe785adfb96a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20O=C5=BEana?= Date: Tue, 31 Oct 2023 16:05:11 +0100 Subject: [PATCH] awk prefixed commands --- example/usage.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/example/usage.sh b/example/usage.sh index ad6e75a..8eec202 100755 --- a/example/usage.sh +++ b/example/usage.sh @@ -9,6 +9,7 @@ function info() { printf "${MAGENTA}$@${NC}\n"; } function warn() { printf "${BOLD_YELLOW}$@${NC}\n"; } function error() { printf "${BOLD_RED}$@${NC}\n"; } function debug() { printf "${BOLD_GRAY}$@${NC}\n"; } +function success() { printf "${BOLD_GREEN}$@${NC}\n"; } info "This is a info test" warn "This is a warn test" @@ -35,3 +36,14 @@ echo "-------------------------------------------------------------------------- # with colors.sh sourced, you can use the constants echo "${RED}This is red text${NC} and this is ${GREEN}green ${BLINK}blink${NC} text${NC}" echo "this is ${MAGENTA}magenta ${BLINK}blink${NC} text${NC}" + + +echo "-----------------------------------------------------------------------------" + +# Add color to the output of a command +{ + echo "This is super text" + echo "Every line will be prefixed with hostname and script name" + printf "${GREEN}This is green text${NC}\n" + printf "${RED}This is red text${NC}\n" +} | awk '{printf "'${GRAY}[${HOSTNAME}'] ['$(basename "$0")']'${NC}' %s\n", $0; fflush(stdout)}' \ No newline at end of file