#!/bin/bash # Function to print a decorated rectangular box with random bright color print_box() { local text="$(cat)" local text_length=${#text} local box_width=$((text_length + 4)) # Generate a random number between 0 and 7 for ANSI bright color code local color_code=$((RANDOM % 8 + 90)) # ANSI escape codes for bright text color local color="\e[${color_code}m" local reset_color="\e[0m" # Top border echo -e "${color}┌$(printf '─%.0s' $(seq 1 $box_width))┐${reset_color}" # Text with borders echo -e "${color}│ $text │${reset_color}" # Bottom border echo -e "${color}└$(printf '─%.0s' $(seq 1 $box_width))┘${reset_color}" }