LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-09-2005, 05:58 AM   #1
TheSpork
Member
 
Registered: May 2003
Location: Norway
Distribution: Ubuntu / Debian
Posts: 40

Rep: Reputation: 15
BASH progressbar


I'm looking for a way to implement a progress bar in a bash-script.

The script I've made "prepares" a bunch of images on my web page, before I'm using the "album"-tool to generate an album. First the script converts all letters to small case, then resizing all images to 800x600, decreases quality and last of all changes the permissions on files and directories.

When I runt his script now, I haven't got any indication of how long it will take, and how much time is left. The "album" script has included this, but the creator of that script is a "little" more advanced than me..

Does anyone know how I can include a hash progress bar (like in "album") so the result will look something like this:

Code:
Converting     [XXXXXXXXXX]
Resizing       [XXXXXX    ]
..and so on..
Any suggestions?
 
Old 10-09-2005, 11:02 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I suppose the first problem this poses is that you'll have to
establish how many actions you'll have to take in this step
before you do the work (probably doesn't make too much
sense in the renaming scenario because finding the files
you need to rename will take about as long as finding and
renaming them). In terms of the conversions it would make
sense since it consumes some cpu and time. I guess you
could calculate the original sizes of all images, and then
time the first three or four, keeping track of the sizes of
the files converted and create those Xs on the fly based
on percentage.

Over all the question is a bit too generic, we don't know
where your problem lies, whether it's the calculation of
the progress or the plain output.


Cheers,
Tink
 
Old 10-09-2005, 11:15 PM   #3
TheSpork
Member
 
Registered: May 2003
Location: Norway
Distribution: Ubuntu / Debian
Posts: 40

Original Poster
Rep: Reputation: 15
Well.. My problem is that I don't know how to show the output.

The first part (changing ABC -> abc) takes about 5 seconds, but resizing the pictures takes several minutes (quite a few images, and my webserver is running on a P3 500MHz w/ 512 MB RAM)

I'm using `find` to locate and resize all the .jpg-images like this:
Code:
find /home/thespork/html/bilder -name '*.jpg' -exec convert -size 800x600 {} -geometry 800x600 {} \; &> /dev/null
With a similar `find`-command, I could get the total size, but don't know where to go from there. Do you know how to output a progress bar when you know the total size of all the images? I'm not quite sure how you can time the first ones and calculate the rest..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PXE Bootsplash and Progressbar dragoncity99 Slackware 3 03-21-2005 07:20 PM
gtk2-perl progressbar game_dev Programming 2 11-17-2004 09:58 AM
bootsplash OK but progressbar not working sigeberht Slackware 4 06-27-2004 07:51 AM
where can find out a progressbar like this quietheart Linux - General 1 02-22-2004 07:11 AM
bootsplash progressbar bugyugo Red Hat 0 12-08-2003 07:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration