]> gitweb.morketsmerke.org Git - backup.git/commitdiff
Dodanie skrypt colors3.sh
authorxf0r3m <jakubstasinski@protonmail.com>
Thu, 28 Sep 2023 12:30:56 +0000 (14:30 +0200)
committerxf0r3m <jakubstasinski@protonmail.com>
Thu, 28 Sep 2023 12:30:56 +0000 (14:30 +0200)
colors3.sh [new file with mode: 0755]

diff --git a/colors3.sh b/colors3.sh
new file mode 100755 (executable)
index 0000000..a22b1ac
--- /dev/null
@@ -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)
+