Created
January 28, 2018 17:38
-
-
Save jigpu/a93ee564622beecce444c753fcfe1b78 to your computer and use it in GitHub Desktop.
Simple script to spin the terminal cursor in various ways.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Note: | |
| # https://en.wikipedia.org/wiki/ANSI_escape_code | |
| # https://www.fileformat.info/info/unicode/block/block_elements/list.htm | |
| function spin { | |
| CHRS=$1 | |
| DELAY=$2 | |
| X=0; | |
| trap "printf '\033[?25h'; exit" 2 | |
| printf '\033[?25l' | |
| while true; do | |
| X=$(((X+1)%${#CHRS})) | |
| #printf '%s\033[1D' "${CHRS:$X:1}" | |
| printf '%s\b' "${CHRS:$X:1}" | |
| sleep $DELAY | |
| done | |
| } | |
| ASCII='-\|/' | |
| BLOCKWISE='▖▘▝▗' | |
| FADE=' ░▒▓█▓▒░' | |
| FISHTAIL=' ▖▌▙█▜▐▝' | |
| GROWXSHRINKX=' ▏▎▍▌▋▊▉█▉▊▋▌▍▎▏' | |
| GROWXSHRINKY=' ▏▎▍▌▋▊▉█▇▆▅▄▃▂▁' | |
| GROWYSHRINKY=' ▁▂▃▄▅▆▇█▇▆▅▄▃▂▁' | |
| spin "$BLOCKWISE" 0.1333 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment