#!/bin/bash function printfill { local columns local string=$1 local char=$2 # test tput sanity first, because "tput cols 2>/dev/null" always reports 80 tput longname &>/dev/null && columns=$(tput cols) || columns=80 echo -ne "$string" for (( i=${#string} ; i<$columns ; i++ )); do echo -n "${2-.}" ; done echo } function cprintfill { local columns local string=$1 local char=$2 local strstr # test tput sanity first, because "tput cols 2>/dev/null" always reports 80 tput longname &>/dev/null && columns=$(tput cols) || columns=80 echo -ne "$string" strstr=$(echo -ne "$string" | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g") for (( i=${#strstr} ; i<$columns ; i++ )); do echo -n "${2-.}" ; done echo } printfill "---[ $USER @ $HOSTNAME ]" "-" cprintfill "---\e[38;5;226m[\e[1;34m $USER \e[1;36m@\e[1;34m $HOSTNAME \e[38;5;226m]\e[1;0m" "-"