mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
Using the Progress Bar Script
Description
This script provides a simple progress bar TUI for the terminal platform. It allows you to visualize the progress of a task being executed in your shell script.
Usage
-
Copy Functions:
- Copy the
delayandprogressfunctions directly into your shell script.
- Copy the
-
Invoke
progressFunction:- Call the
progressfunction within your script to display the progress bar.
- Call the
Steps
-
Copy Functions:
- Copy the
delayandprogressfunctions from the script provided into your own shell script. These functions handle the delay and printing of the progress bar.
- Copy the
-
Invoke
progressFunction:- Within your script, call the
progressfunction whenever you want to display the progress bar. - Pass two parameters to the
progressfunction:PARAM_PROGRESS: The progress percentage (0-100) of the task.PARAM_STATUS: Optional. A status message to display alongside the progress bar.
# Example usage: progress 25 "Processing data..." # Displays a 25% progress bar with the status "Processing data..." - Within your script, call the
Example
#!/bin/bash
# Copy the delay and progress functions here
# Your script logic here
# Invoke the progress function to display the progress bar as your script progresses
# Example:
progress 25 "Processing data..." # Display a 25% progress bar with the status "Processing data..."
This will visually represent the progress of your script's execution in the terminal. Adjust the progress function calls according to the progress of your task.