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?
برچسب:
نویسنده: استخدام کار