The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[PERL] Running unix commands within Perl Scripts userix Shell Programming and Scripting 1 05-28-2008 03:06 PM
UNIX memory problems w/Progress DB eddiej UNIX and Linux Applications 0 12-12-2007 09:06 AM
perl progress bar dialog fed.linuxgossip Shell Programming and Scripting 4 09-18-2007 07:40 AM
IBM Unix progress gains kudos - VNUNet.com iBot UNIX and Linux RSS News 0 07-18-2007 09:20 AM
TAR- Progress bar? dicko44 Shell Programming and Scripting 1 09-01-2006 05:11 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2007
Registered User
 

Join Date: Aug 2007
Posts: 10
Lightbulb Progress Bar in Perl for UNIX

Hi Programmers,

I just wrote a small script to print the percent complete.
This maybe useful for someone!



Code:
#!/usr/local/bin/perl

# Total from which percentage will be calculated
$cnt = 16;

$|=1;
for($i=0;$i<$cnt;$i++)
{

	# Calculate Percentage
	$percent = ($i/$cnt)*100;		


        # Print Progress
	for($k=0;$k<$percent;$k=$k+5)
	{
		print "|";						
	}
	print " <-- $percent% Complete --> ";

        # Goto the start of the line
	print "\r";
	
	sleep 1;
}

print "\n>>>>>>>>>>---------100% Complete---------<<<<<<<<<<\n";
Thanks,
.:: HiFake ::.
Reply With Quote
Google UNIX.COM
Forum Sponsor
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:45 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0