Wanting to center text
by billlove from LinuxQuestions.org on (#565B6)
This code will justify the text "Start Program" in the left center of the terminal window. I'd like it in the center. If anyone has any suggestions, much appreciated.
cols=$( tput cols )
rows=$( tput lines )
message=Start Program
input_length=${#message}
half_input_length=$(( $input_length / 2 ))
middle_row=$(( $rows / 2 ))
middle_col=$(( ($col /2 ) - half_input_length ))
tput clear
tput cup $middle_row $middle_col
tput bold
echo Start Program
tput sgr0
tput cup $( tput lines ) 0


cols=$( tput cols )
rows=$( tput lines )
message=Start Program
input_length=${#message}
half_input_length=$(( $input_length / 2 ))
middle_row=$(( $rows / 2 ))
middle_col=$(( ($col /2 ) - half_input_length ))
tput clear
tput cup $middle_row $middle_col
tput bold
echo Start Program
tput sgr0
tput cup $( tput lines ) 0