blob: 9c421fc41aa28c87fcc79c2a42a0eb02fdd9ffc6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/bin/sh
str="$1"
[[ -n $str ]] && str=" $str "
getcols() {
if command -v tput &>/dev/null; then
tput cols
else
stty size | awk '{print $2}'
fi
}
COLS=$((${COLUMNS:-`getcols`} - ${#str} - 2))
start=$'\e(0'; end=$'\e(B'; line="qqqqqqqqqqqqqqqq"
while ((${#line}<$COLS)); do line+=$line; done
printf "╾" # └
printf "%s%s%s" "$start" "${line:0:$((COLS/2))}" "$end"
printf "%s" "$str"
printf "%s%s%s" "$start" "${line:0:$((COLS/2))}" "$end"
printf "╼" # ┐
printf "\n"
|