From 9c4818a4156a395fc6b67adfa2dccea975bd54a6 Mon Sep 17 00:00:00 2001 From: xf0r3m Date: Thu, 28 Sep 2023 14:30:56 +0200 Subject: [PATCH] Dodanie skrypt colors3.sh --- colors3.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 colors3.sh diff --git a/colors3.sh b/colors3.sh new file mode 100755 index 0000000..a22b1ac --- /dev/null +++ b/colors3.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Its NOT my solution. Works only with standard font. +# Taken from: https://stackoverflow.com/a/70439210 (little bit modified, the +# awk commands and printf command for better understand) + +BLUE="\e[1;94m"; +RED="\e[1;91m"; +CYAN="\e[1;96m"; +ENDCOLOR="\e[0m"; + +echo -n "immu" | figlet > /tmp/immu.file; +echo -n "de" | figlet > /tmp/de.file; +echo -n "x" | figlet > /tmp/x.file; + +l1=$(awk '{max=length($0)}END{print max}' /tmp/immu.file); +l2=$(awk '{max=length($0)}END{print max}' /tmp/de.file); + +while IFS="@" read -r p1 p2 p3 +do + #printf "${BLUE}%-*s${RED}%-*s${CYAN}%s${ENDCOLOR}\n" "${l1}" "${p1}" "${l2}" "${p2}" "${p3}" + printf "${BLUE}%-${l1}s${RED}%-${l2}s${CYAN}%s${ENDCOLOR}\n" "${p1}" "${p2}" "${p3}" +done < <(paste -d"@" /tmp/immu.file /tmp/de.file /tmp/x.file) + -- 2.39.5