-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbarred
37 lines (31 loc) · 1.42 KB
/
barred
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#----------------------------------------------------------------------------------
# Project Name - miscellaneous/barred
# Started On - Sun 19 Nov 13:56:45 GMT 2017
# Last Change - Sat 24 Mar 00:55:47 GMT 2018
# Author E-Mail - [email protected]
# Author GitHub - https://github.com/terminalforlife
#----------------------------------------------------------------------------------
# This small file was written to be executed within a shell script. Make sure your
# script can handle this output properly, such as muting its own output while in
# the bar sections. This is a rudimentary, small progress bar.
#
# SYNTAX: barred B[[0|25|50|75|100]|P]
#----------------------------------------------------------------------------------
_VERSION_="2018-03-24"
B=(𝍥:0 𝍦:25 𝍧:50 𝍨:75 𝍤:100 )
case "$1" in
B0) printf "\r%s" "${B[0]%:*}" ;;
B0P) printf "\r%s %d%%" "${B[0]%:*}" "${B[0]/*:}" ;;
B25) printf "\r%s" "${B[1]%:*}" ;;
B25P) printf "\r%s %d%%" "${B[1]%:*}" "${B[1]/*:}" ;;
B50) printf "\r%s" "${B[2]%:*}" ;;
B50P) printf "\r%s %d%%" "${B[2]%:*}" "${B[2]/*:}" ;;
B75) printf "\r%s" "${B[3]%:*}" ;;
B75P) printf "\r%s %d%%" "${B[3]%:*}" "${B[3]/*:}" ;;
B100) printf "\r%s" "${B[4]%:*}" ;;
B100P) printf "\r%s %d%%" "${B[4]%:*}" "${B[4]/*:}" ;;
*) printf "SYNTAX: barred B[[0|25|50|75|100]|P]\n" ;;
esac
unset B
# vim: noexpandtab colorcolumn=84 tabstop=8 noswapfile nobackup