Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep a progress bar on top. Linux

Okay so I was just wondering if there is a way to have a progress bar on the top as the script is running to tell the user that x% of the process has been completed. Also is there a command that is built into the OS that would let me use a progress bar or would i have to design that as well in code?

like image 281
bloodstorm17 Avatar asked Dec 06 '25 10:12

bloodstorm17


2 Answers

Include in your script a percentage tracker, but will consume more resources...

For example if you are copying a bunch of files:

` foreach $y (@files) {

$countline++;
$total = 1000;
$lastcount = $currentcount
$currentcount = $countline / $total

if ( $lastcount > $currentcount ) {
    $progress_display == 1
    $currentcount

    if ($progress_display == 1) {
            print ".";
    }

} print "\n"; `

like image 82
Yannick Avatar answered Dec 08 '25 02:12

Yannick


There is zenity, a GTK application with GUI elements for scripts. It has a progress bar and much more.

The package dialog provides several UI elements for shell scripting. One of them is a gauge, a progress bar. Debian maintains a simplified version of dialog called whiptail.

There is also an X version of dialog: Xdialog, but I have never seen it myself.

like image 24
fork0 Avatar answered Dec 08 '25 02:12

fork0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!