![]() |
|

CircumstancesThere must be a reason to write a software. We use unix-like shell scripts in application development on mac os X. Some scripts copies resource files, some other completes application bundles, some others prepares tar and gz files or send mails with attach. Other scripts can make automatic back-ups or other important operations.DescriptionEverytime, you start shellscripts manually, doubleclicking on the file that opens the terminal or launching the script from the terminal. This is not a particular problem, but, first, it's not nice to see. Second, you need to pay attention to what happens on the screen to understand if the operation run correctly or not. Most of the times you have to scroll back some pages to see if you had a bad result command. Third, if operations are long, you have problems to understand what the script is doing during its execution.
We realized this application, "a progress bar and status viewer for shell scripts", which solves the problem.
Shellbar is a standard application which accepts "shell scripts" as documents. Simply rename your ".sh" documents to ".shbar" documents. Open the .shbar document, doubleclicking on it, and the shellbar window will appear.Customization
The script execution will start shortly, and when the end is reached, the progress bar will be at "100%" position, the semaphore lights will pass from yellow to green. And the application will quit. The window title bar and the descriptions will be extracted from the file name, giving generic informations.
The nice thing is that with some simple customization of your scripts, you can change during the script execution the following progress window items
- title bar
- description (2 lines)
- detailed description
- position of graphic progress bar
- progress label
and also change the following
- Error status (so at the end of the script the red led will be light instead of green)
- Enable auto window close at the end of script
- Disable rewrite of informations at end of script
How to do it ? Shell bar application simply parses the output of the script on the console (it redirects the output on a temporary file). You have only to insert some innocent lines your scripts with the format
echo shellbar_setting=value
So if you have a script like the following
#!/bin/shcd `dirname $0`tar rvf /tmp/my_documents mydocs.targzip -c mydocs.tar > mydocs.tgzrm mydocs.tar
you could add some info like
#!/bin/shcd `dirname $0`echo shellbar_title=Data backupecho shellbar_message=Generating backup files for my important documentsecho shellbar_tot=4echo shellbar_pos=1echo shellbar_info=Preparing tar archive...tar rvf /tmp/my_documents mydocs.tarecho shellbar_pos=2echo shellbar_info=Zipping archive...gzip -c mydocs.tar > mydocs.tgzecho shellbar_pos=3echo shellbar_info=Removing temporary filesrm mydocs.tarecho shellbar_pos=4echo shellbar_info=Doneecho shellbar_message=Backup ready in mydocs.tgz
and the shellbar application will set the graphical bar and all the information during script execution.
Shellbar tags descriptionDistribution
shellbar_title=textSets the window title with the text passed shellbar_messge=textSets the message field with the text value, 2 lines with automatic wrapping are available shellbar_info=textSets the small information field over the progress bar. 1 line of text is available. shellbar_cents=valueSets the graphical progress bar. Value range is from 0 to 100. Values outside this range will be forced to stay within it. shellbar_counter=textSets the small progress text information field, at right of the graphical progress bar. shellbar_tot=valueshellbar_pos=valueThese two tags helps in using the progress bar and the progress text field. If shellbar_tot is given, shellbar_pos sets the progressbar with pos/tot percent values and the text is updated with pos / tot accordingly. Value should be an integer, ranging from 0...N shellbar_error=textIf set, at the end of the script, the red led is light instead of the green one. The text is displayed in the information field. If an empty text is passed, the error flag is cleared. shellbar_quit_at_end=valueIf value is 1, the window will close at the end of the script. If value is 0 it will not, and the user will have to press "Close" manually. If the last window is closed, the application is automatically quit. The default setting is 0. shellbar_rewrite_info_at_end=valueIf value is 1, at the end of the script there will be standard informations text on the labels, like "Operation terminated" and the progress bar set to 100%. If value is 0, nothing will be overwritten, so your last text informations and bar status will be mainteined. Default setting is 1.
Shellbar 1.0 is postcardware ! If you like it send us a postcard from your country to the contact address of Alea. Shellbar can be distributed freely as long as it is not changed in any part. Must be distributed with the licence agreement file enclosed in the following download archive. Shellbar is copyright Alea Srl 2004.
DownloadDownload shallbar 1.0 for MacOS X at ShellBar_10_r_2_osx.tgz.
The Win32 and Linux86 version will be available soon.
CommentsWrite your comments to the contact address of Alea.
Any suggestion will be appreciated.
HistoryVersion 1.0, 17 Aug 2004
Thanks to
First public release, for mac os x platform only.
Moka, for status led display