print to the end of terminal
问题 Like this picture of apt-get, how can I print something at the end of the line, just like the speed on the screen. Although I can use escape like \e[C to make it move several columns to the right and print, but the speed varies and the string length varies. Can anyone tell me how to do this? I am currently programming using bash. Thanks. 回答1: Often you will find the width of the console window in the environment variable COLUMNS, but this is not completely reliable. A more reliable solution