How do I center text generated by Toilet?

خرید بک لینک

To center text in general, you can use this

#!/bin/bash

center(){
    tc=$(tput cols)
    while IFS= read -r line; do
        sp=$((($tc-${#line})/2+${#line})/2+${#line}))
        printf "%${sp}sn" $line
    done
}

# This works, but is not center
# toilet -w $(tput cols) -f bigmono9 "$1" | lolcat

# This works, but is not big
# echo "$1" | center | lolcat

# This does not work.
# toilet -w $(tput cols) -f bigmono9 "$1" | center | lolcat

# This kinda works but not the way it should, 
# but it adds a lot of lines in between
echo "$1" | center | toilet -w $(tput cols) -f bigmono9 | lolcat

What I'd like to know is what do I need to do to fix it?

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 141 تاريخ: سه شنبه 11 خرداد 1395 ساعت: 10:59

صفحه بندی