├── .github
└── ISSUE_TEMPLATE
│ ├── report-a-broken-animation.yml
│ └── submit-an-animation.yml
├── LICENSE
├── README.md
├── bash_loading_animations.demo
├── bash_loading_animations.sh
└── demo.gif
/.github/ISSUE_TEMPLATE/report-a-broken-animation.yml:
--------------------------------------------------------------------------------
1 | name: Report a broken animation
2 | description: Report a display issue with an existing animation.
3 | title: "[Broken animation] "
4 | labels: ["bug"]
5 | assignees:
6 | - Silejonu
7 | body:
8 | - type: markdown
9 | attributes:
10 | value: |
11 | Thanks for taking the time to improve the collection!
12 | - type: checkboxes
13 | id: download-method
14 | attributes:
15 | label: Download method
16 | description: Make sure to download the script via
17 | `git clone https://github.com/Silejonu/bash_loading_animations`,
18 | `wget https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.sh`,
19 | or `curl -O https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.demo`.
20 | If you did not, **broken animations are to be expected**, as doing otherwise will convert the non-breaking spaces to regular spaces.
21 | options:
22 | - label: I used one of the above methods to download the script, and I still have an issue.
23 | required: true
24 | - type: input
25 | id: affected-animation
26 | attributes:
27 | label: Affected animation
28 | description: If you found that several animations have issues, please fill a separate bug report for each of them.
29 | placeholder: ex. classic
30 | validations:
31 | required: true
32 | - type: input
33 | id: terminal
34 | attributes:
35 | label: Terminal used
36 | placeholder: ex. GNOME Terminal, Alacritty, st, Konsole, TTY…
37 | validations:
38 | required: true
39 | - type: input
40 | id: os
41 | attributes:
42 | label: Operating System
43 | placeholder: ex. Ubuntu, Fedora, macOS, WSL…
44 | validations:
45 | required: true
46 | - type: dropdown
47 | id: unicode
48 | attributes:
49 | label: UTF-8 support
50 | description: Please verify that your terminal supports UTF-8. Check the output of `echo -e '\xe2\x82\xac'`. If you see `€` then it is working correctly. If not, you may need to enable UTF-8 support or use a font with a wider range of supported characters.
51 | options:
52 | - My terminal does indeed support UTF-8
53 | - I want to report an issue with an ASCII animation
54 | validations:
55 | required: true
56 | - type: input
57 | id: font
58 | attributes:
59 | label: Terminal font
60 | placeholder: ex. Noto Sans Mono, JetBrains Mono, D2Coding, Hack, DejaVu Sans Mono…
61 | validations:
62 | required: true
63 | - type: textarea
64 | id: additional-comments
65 | attributes:
66 | label: Additional comments
67 | description: Anything else? Please tell us!
68 | placeholder: ex. The animation `foo` does not loop correctly.
69 | validations:
70 | required: false
71 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/submit-an-animation.yml:
--------------------------------------------------------------------------------
1 | name: Submit an animation
2 | description: Propose a new animation to be included.
3 | title: "[New animation] "
4 | labels: ["enhancement"]
5 | assignees:
6 | - Silejonu
7 | body:
8 | - type: markdown
9 | attributes:
10 | value: |
11 | Thanks for taking the time to expand the collection!
12 | Describe the animation(s) you'd like to be included, or directly submit them with the appropriate syntax.
13 | Feel free to open a pull request if you prefer: just make sure to follow the guidelines described below.
14 | - type: textarea
15 | id: syntax
16 | validations:
17 | required: true
18 | attributes:
19 | label: Animation(s)
20 | description:
21 | "`animation_name=( interval_between_each_frame 'frame 01' 'frame 02' 'frame 03' 'frame 04' )`
22 |
23 | * `interval_between_each_frame` is a number, expressed in seconds.
24 |
25 | * You can include as little or as much frames as you want (well, maybe not 1 or 999!).
26 |
27 | * Each frame must be separated by a space.
28 |
29 | * Do not quote the frames unless you need to, in which case, use single-quotes.
30 |
31 | * If you must include spaces in your animation, use **non-breaking spaces** (U+00A0), and single-quote each frame.
32 |
33 | * All frames in a single animation **must** be of equal width. Add non-breaking spaces to fill the gaps."
34 |
35 | render: shell
36 | placeholder:
37 | bubble=( 0.6 · o O O o · )
38 |
39 | arrow=( 0.15 ▹▹▹▹▹ ▸▹▹▹▹ ▹▸▹▹▹ ▹▹▸▹▹ ▹▹▹▸▹ ▹▹▹▹▸ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ )
40 |
41 | bomb=( 0.25 '💣 ' ' 💣 ' ' 💣 ' ' 💣' ' 💣' ' 💣' ' 💣' ' 💣' ' 💥' ' ' ' ' )
42 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Silejonu
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # The ultimate collection of loading animations for Bash
2 | Ready-to-use loading animations in ASCII and UTF-8 for easy integration into your Bash scripts.
3 |
4 | **Have an idea for a nice-looking animation? [Please help expand the collection!](https://github.com/Silejonu/bash_loading_animations/issues/new?assignees=Silejonu&labels=enhancement&template=submit-an-animation.yml&title=%5BNew+animation%5D+)**
5 |
6 |
7 |
8 | 
9 |
10 |
11 |
12 | ⚠ ***Important note:*** do not copy the raw script file from your browser or **you will have broken animations**, as the non-breaking spaces will be converted into regular spaces.
13 |
14 | Instead, use one of the following methods to retrieve the script:
15 | ```bash
16 | git clone https://github.com/Silejonu/bash_loading_animations
17 | ```
18 | ```bash
19 | curl -O https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.sh
20 | curl -O https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.demo
21 | ```
22 | ```bash
23 | wget https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.sh
24 | wget https://raw.githubusercontent.com/Silejonu/bash_loading_animations/main/bash_loading_animations.demo
25 | ```
26 |
27 | Run the provided script `bash_loading_animations.demo` to quickly visualise the available animations.
28 |
29 | ## Add support for loading animations to your script
30 |
31 | Put these lines at the top of your script:
32 |
33 | ```bash
34 | # Load in the functions and animations
35 | source /path/to/bash_loading_animations.sh
36 | # Run BLA::stop_loading_animation if the script is interrupted
37 | trap BLA::stop_loading_animation SIGINT
38 | ```
39 |
40 | *Don't forget to replace `/path/to/bash_loading_animations.sh` with the appropriate filepath.*
41 |
42 | ## Show a loading animation for `foo`
43 | Show a loading animation for the command `foo`:
44 | ```bash
45 | BLA::start_loading_animation "${BLA_name_of_the_animation[@]}"
46 | foo
47 | BLA::stop_loading_animation
48 | ```
49 |
50 | If `foo` prints some output in the terminal, you may want to add:
51 | ```bash
52 | foo 1> /dev/null # hide standard output
53 | # or
54 | foo 2> /dev/null # hide error messages
55 | # or
56 | foo &> /dev/null # hide all output
57 | ```
58 |
59 | #
60 | > Some of the animations have been adapted from https://github.com/sindresorhus/cli-spinners.
61 |
--------------------------------------------------------------------------------
/bash_loading_animations.demo:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # shellcheck disable=SC2034 # https://github.com/koalaman/shellcheck/wiki/SC2034
4 |
5 | # Load in the functions and animations
6 | source ./bash_loading_animations.sh
7 | # Run BLA::stop_loading_animation if the script is interrupted
8 | trap BLA::stop_loading_animation SIGINT
9 |
10 | demo_loading_animation() {
11 | BLA_active_loading_animation=( "${@}" )
12 | # Extract the delay between each frame from the active_loading_animation array
13 | BLA_loading_animation_frame_interval="${BLA_active_loading_animation[0]}"
14 | # Sleep long enough that all frames are showed
15 | # substract 1 to the number of frames to account for index [0]
16 | demo_duration=$( echo "${BLA_active_loading_animation[0]} * ( ${#BLA_active_loading_animation[@]} - 1 )" | bc )
17 | # Make sure each animation is shown for at least 3 seconds
18 | if [[ $( echo "if (${demo_duration} < 3) 0 else 1" | bc ) -eq 0 ]] ; then
19 | demo_duration=3
20 | fi
21 | unset "BLA_active_loading_animation[0]"
22 | echo
23 | BLA::play_loading_animation_loop &
24 | BLA_loading_animation_pid="${!}"
25 | sleep "${demo_duration}"
26 | kill "${BLA_loading_animation_pid}" &> /dev/null
27 | clear
28 | }
29 |
30 | tput civis # Hide the terminal cursor
31 | clear
32 |
33 | demo_loading_animation "${BLA_classic[@]}"
34 | demo_loading_animation "${BLA_box[@]}"
35 | demo_loading_animation "${BLA_bubble[@]}"
36 | demo_loading_animation "${BLA_breathe[@]}"
37 | demo_loading_animation "${BLA_growing_dots[@]}"
38 | demo_loading_animation "${BLA_passing_dots[@]}"
39 | demo_loading_animation "${BLA_metro[@]}"
40 | demo_loading_animation "${BLA_snake[@]}"
41 | demo_loading_animation "${BLA_filling_bar[@]}"
42 | demo_loading_animation "${BLA_classic_utf8[@]}"
43 | demo_loading_animation "${BLA_bounce[@]}"
44 | demo_loading_animation "${BLA_vertical_block[@]}"
45 | demo_loading_animation "${BLA_horizontal_block[@]}"
46 | demo_loading_animation "${BLA_quarter[@]}"
47 | demo_loading_animation "${BLA_triangle[@]}"
48 | demo_loading_animation "${BLA_semi_circle[@]}"
49 | demo_loading_animation "${BLA_rotating_eyes[@]}"
50 | demo_loading_animation "${BLA_firework[@]}"
51 | demo_loading_animation "${BLA_braille[@]}"
52 | demo_loading_animation "${BLA_braille_whitespace[@]}"
53 | demo_loading_animation "${BLA_trigram[@]}"
54 | demo_loading_animation "${BLA_arrow[@]}"
55 | demo_loading_animation "${BLA_bouncing_ball[@]}"
56 | demo_loading_animation "${BLA_big_dot[@]}"
57 | demo_loading_animation "${BLA_modern_metro[@]}"
58 | demo_loading_animation "${BLA_pong[@]}"
59 | demo_loading_animation "${BLA_earth[@]}"
60 | demo_loading_animation "${BLA_clock[@]}"
61 | demo_loading_animation "${BLA_moon[@]}"
62 | demo_loading_animation "${BLA_orange_pulse[@]}"
63 | demo_loading_animation "${BLA_blue_pulse[@]}"
64 | demo_loading_animation "${BLA_football[@]}"
65 | demo_loading_animation "${BLA_blink[@]}"
66 | demo_loading_animation "${BLA_camera[@]}"
67 | demo_loading_animation "${BLA_sparkling_camera[@]}"
68 | demo_loading_animation "${BLA_sick[@]}"
69 | demo_loading_animation "${BLA_monkey[@]}"
70 | demo_loading_animation "${BLA_bomb[@]}"
71 |
72 | tput cnorm # Restore the terminal cursor
73 |
74 | exit 0
75 |
--------------------------------------------------------------------------------
/bash_loading_animations.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Source: https://github.com/Silejonu/bash_loading_animations
4 |
5 | # shellcheck disable=SC2034 # https://github.com/koalaman/shellcheck/wiki/SC2034
6 |
7 | ### Loading animations list ###
8 | # The first value of an array is the interval (in seconds) between each frame
9 |
10 | ## ASCII animations ##
11 | # Will work in any terminal, including the TTY.
12 | BLA_classic=( 0.25 '-' "\\" '|' '/' )
13 | BLA_box=( 0.2 ┤ ┴ ├ ┬ )
14 | BLA_bubble=( 0.6 · o O O o · )
15 | BLA_breathe=( 0.9 ' () ' ' ( ) ' '( )' ' ( ) ' )
16 | BLA_growing_dots=( 0.5 '. ' '.. ' '...' '.. ' '. ' ' ' )
17 | BLA_passing_dots=( 0.25 '. ' '.. ' '...' ' ..' ' .' ' ' )
18 | BLA_metro=( 0.2 '[ ]' '[= ]' '[== ]' '[=== ]' '[ ===]' '[ ==]' '[ =]' )
19 | BLA_snake=( 0.4 '[= ]' '[~< ]' '[~~= ]' '[~~~< ]' '[ ~~~= ]' '[ ~~~<]' '[ ~~~]' '[ ~~]' '[ ~]' '[ ]' )
20 | BLA_filling_bar=( 0.25 '█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '█████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '█████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '█████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '██████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒' '███████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒' '████████████████████▒▒▒▒▒▒▒▒▒▒▒▒' '█████████████████████▒▒▒▒▒▒▒▒▒▒▒' '██████████████████████▒▒▒▒▒▒▒▒▒▒' '███████████████████████▒▒▒▒▒▒▒▒▒' '████████████████████████▒▒▒▒▒▒▒▒' '█████████████████████████▒▒▒▒▒▒▒' '██████████████████████████▒▒▒▒▒▒' '███████████████████████████▒▒▒▒▒' '████████████████████████████▒▒▒▒' '█████████████████████████████▒▒▒' '██████████████████████████████▒▒' '███████████████████████████████▒' '████████████████████████████████')
21 |
22 | ## UTF-8 animations ##
23 | # Require Unicode support (will work in most modern terminals, but not in TTY).
24 | # Some animations may not render properly with certain fonts.
25 | BLA_classic_utf8=( 0.25 '—' "\\" '|' '/' )
26 | BLA_bounce=( 0.3 . · ˙ · )
27 | BLA_vertical_block=( 0.25 ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ █ ▇ ▆ ▅ ▄ ▃ ▂ ▁ )
28 | BLA_horizontal_block=( 0.25 ▏ ▎ ▍ ▌ ▋ ▊ ▉ ▉ ▊ ▋ ▌ ▍ ▎ ▏ )
29 | BLA_quarter=( 0.25 ▖ ▘ ▝ ▗ )
30 | BLA_triangle=( 0.45 ◢ ◣ ◤ ◥)
31 | BLA_semi_circle=( 0.1 ◐ ◓ ◑ ◒ )
32 | BLA_rotating_eyes=( 0.4 ◡◡ ⊙⊙ ⊙⊙ ◠◠ )
33 | BLA_firework=( 0.4 '⢀' '⠠' '⠐' '⠈' '*' '*' ' ' )
34 | BLA_braille=( 0.2 ⠁ ⠂ ⠄ ⡀ ⢀ ⠠ ⠐ ⠈ )
35 | BLA_braille_whitespace=( 0.2 ⣾ ⣽ ⣻ ⢿ ⡿ ⣟ ⣯ ⣷ )
36 | BLA_trigram=( 0.25 ☰ ☱ ☳ ☶ ☴ )
37 | BLA_arrow=( 0.15 ▹▹▹▹▹ ▸▹▹▹▹ ▹▸▹▹▹ ▹▹▸▹▹ ▹▹▹▸▹ ▹▹▹▹▸ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ ▹▹▹▹▹ )
38 | BLA_bouncing_ball=( 0.4 '(● )' '( ● )' '( ● )' '( ● )' '( ● )' '( ●)' '( ● )' '( ● )' '( ● )' '( ● )' )
39 | BLA_big_dot=( 0.7 ∙∙∙ ●∙∙ ∙●∙ ∙∙● )
40 | BLA_modern_metro=( 0.15 ▰▱▱▱▱▱▱ ▰▰▱▱▱▱▱ ▰▰▰▱▱▱▱ ▱▰▰▰▱▱▱ ▱▱▰▰▰▱▱ ▱▱▱▰▰▰▱ ▱▱▱▱▰▰▰ ▱▱▱▱▱▰▰ ▱▱▱▱▱▱▰ ▱▱▱▱▱▱▱ ▱▱▱▱▱▱▱ ▱▱▱▱▱▱▱ ▱▱▱▱▱▱▱ )
41 | BLA_pong=( 0.35 '▐⠂ ▌' '▐⠈ ▌' '▐ ⠂ ▌' '▐ ⠠ ▌' '▐ ⡀ ▌' '▐ ⠠ ▌' '▐ ⠂ ▌' '▐ ⠈ ▌' '▐ ⠂ ▌' '▐ ⠠ ▌' '▐ ⡀ ▌' '▐ ⠠ ▌' '▐ ⠂ ▌' '▐ ⠈ ▌' '▐ ⠂▌' '▐ ⠠▌' '▐ ⡀▌' '▐ ⠠ ▌' '▐ ⠂ ▌' '▐ ⠈ ▌' '▐ ⠂ ▌' '▐ ⠠ ▌' '▐ ⡀ ▌' '▐ ⠠ ▌' '▐ ⠂ ▌' '▐ ⠈ ▌' '▐ ⠂ ▌' '▐ ⠠ ▌' '▐ ⡀ ▌' '▐⠠ ▌' )
42 | BLA_earth=( 0.45 🌍 🌎 🌏 )
43 | BLA_clock=( 0.2 🕛 🕐 🕑 🕒 🕓 🕔 🕕 🕖 🕗 🕘 🕙 🕚 )
44 | BLA_moon=( 0.8 🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘 )
45 | BLA_orange_pulse=( 0.35 🔸 🔶 🟠 🟠 🔶 )
46 | BLA_blue_pulse=( 0.35 🔹 🔷 🔵 🔵 🔷 )
47 | BLA_football=( 0.25 ' 👧⚽️ 👦' '👧 ⚽️ 👦' '👧 ⚽️ 👦' '👧 ⚽️ 👦' '👧 ⚽️ 👦' '👧 ⚽️ 👦' '👧 ⚽️👦 ' '👧 ⚽️ 👦' '👧 ⚽️ 👦' '👧 ⚽️ 👦' '👧 ⚽️ 👦' '👧 ⚽️ 👦' )
48 | BLA_blink=( 0.25 😐 😐 😐 😐 😐 😐 😐 😐 😐 😑 )
49 | BLA_camera=( 0.1 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📷 📸 📷 📸 )
50 | BLA_sparkling_camera=( 0.1 '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📷 ' '📸✨' '📷 ' '📸✨' )
51 | BLA_sick=( 0.9 🤢 🤢 🤮 )
52 | BLA_monkey=( 0.4 🙉 🙈 🙊 🙈 )
53 | BLA_bomb=( 0.25 '💣 ' ' 💣 ' ' 💣 ' ' 💣' ' 💣' ' 💣' ' 💣' ' 💣' ' 💥' ' ' ' ' )
54 |
55 | declare -a BLA_active_loading_animation
56 |
57 | BLA::play_loading_animation_loop() {
58 | while true ; do
59 | for frame in "${BLA_active_loading_animation[@]}" ; do
60 | printf "\r%s" "${frame}"
61 | sleep "${BLA_loading_animation_frame_interval}"
62 | done
63 | done
64 | }
65 |
66 | BLA::start_loading_animation() {
67 | BLA_active_loading_animation=( "${@}" )
68 | # Extract the delay between each frame from array BLA_active_loading_animation
69 | BLA_loading_animation_frame_interval="${BLA_active_loading_animation[0]}"
70 | unset "BLA_active_loading_animation[0]"
71 | tput civis # Hide the terminal cursor
72 | BLA::play_loading_animation_loop &
73 | BLA_loading_animation_pid="${!}"
74 | }
75 |
76 | BLA::stop_loading_animation() {
77 | kill "${BLA_loading_animation_pid}" &> /dev/null
78 | printf "\n"
79 | tput cnorm # Restore the terminal cursor
80 | }
81 |
82 |
83 | ###############################################################################
84 | ################################# USAGE GUIDE #################################
85 | ###############################################################################
86 | ################## Read below for the explanations on how to ##################
87 | ################### show loading animations in your script. ###################
88 | ###############################################################################
89 |
90 | :<<'EXAMPLES'
91 |
92 | ## Put these lines at the top of your script:
93 | ## (replace /path/to/bash_loading_animations.sh with the appropriate filepath)
94 | # Load in the functions and animations
95 | source /path/to/bash_loading_animations.sh
96 | # Run BLA::stop_loading_animation if the script is interrupted
97 | trap BLA::stop_loading_animation SIGINT
98 |
99 | # Show a loading animation for the command "foo"
100 | BLA::start_loading_animation "${BLA_name_of_the_animation[@]}"
101 | foo
102 | BLA::stop_loading_animation
103 |
104 | # If foo prints some output in the terminal, you may want to add:
105 | foo 1> /dev/null # hide standard output
106 | # or
107 | foo 2> /dev/null # hide error messages
108 | # or
109 | foo &> /dev/null # hide all output
110 |
111 | EXAMPLES
112 |
--------------------------------------------------------------------------------
/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Silejonu/bash_loading_animations/e32301d1bcfa09db249aea60910f2880083d399b/demo.gif
--------------------------------------------------------------------------------