0
我一直在製作一個Bash腳本,上面寫着「由Keegan Kuhn製作」。但是,我無法將文本居中。爲什麼這個文本不居中?
在開始的時候,我定義了一些顏色,使五彩文字:
# Defines colors
black='tput setaf 0'
red='tput setaf 1'
green='tput setaf 2'
yellow='tput setaf 3'
purple='tput setaf 4'
pink='tput setaf 5'
skyBlue='tput setaf 6'
white='tput setaf 7'
grey='tput setaf 8'
在那裏我有問題是在最後幾行的部分:
string="Disguise your MAC Address as that of any manufacturer as you want."
sleep .2; printf "%*s\n" $(((${#string} + $(tput cols))/2)) "$string" # Centers variable "string"
echo
string="$($skyBlue)Made by:$($green) Keegan Kuhn ($($red)keeganjk$($green))"
sleep .2; printf "%*s\n" $(((${#string} + $(tput cols))/2)) "$string" # Centers variable "string"
爲什麼是文字坐向左而不是居中?
它僅僅是第二個不居中的字符串嗎? – 123