Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
12
rated 0 times [  12] [ 0]  / answers: 1 / hits: 3850  / 3 Years ago, wed, november 10, 2021, 10:21:06

When I use sudo apt-get install <package-name> for installing any package, I observe the following:


Downloading some packages (78%)

This line once printed never changes its position but instead keeps on updating itself with percentage values. While other things are changing this line remains constant! How do they do it?


enter image description here


More From » bash

 Answers
7

You probably need to look at what echo -ne '
'
does.



Here is an example:



echo -ne 'Downloading 1%
'
sleep 1

echo -ne 'Downloading 100%
'
sleep 1

echo -ne '
'

[#27345] Wednesday, November 10, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pipeag

Total Points: 489
Total Questions: 107
Total Answers: 115

Location: Iraq
Member since Fri, Jun 5, 2020
4 Years ago
;