Problem with space padding
I "thought" this was how to pad spaces in front of a line:
spaces=" " pdl=12 pad=`echo "$spaces" | cut -c $pdl` echo "B${pad}E" but I get: B E I've tried with a constant instead of "$pdl" and get the same thing. I "THINK" I have used this before but I am not able to get the proper pad length created. Use of printf had similar problems. Does anyone see my mistake. I would like to find a correction rather than an alternate padding solution since I feel certain I've used this before. Thanks |
use printf
Code:
printf "B%12sE\n" Code:
printf "%*s%*s%s\n" $(( ${COLUMNS} / 2 )) "B" $((12+1)) "E" Code:
Centre="This is in centre" |
All times are GMT -5. The time now is 11:15 AM. |