Outline ·
[ Standard ] ·
Linear+
C# How did they create wait cursor?, In character subsystem
|
silverhawk
|
Mar 18 2022, 03:06 PM
|
Eyes on Target
|
This is done quite commonly in bash scripts, there are plenty of ways to do progress indicators as well. Here's a simple spinner example CODE #!/bin/bash function shutdown() { # reset cursor tput cnorm } trap shutdown EXIT
function spinner() { # cursor invisible tput civis
frames='-\|/' input="" i=0 while [[ -z $input ]]; do read -rsn1 -t 0.1 input
i=$(( (i+1) %4 )) printf "\r${frames:$i:1}" sleep .1 done
# restore cursor tput cnorm }
spinner
|
|
|
|
|
|
silverhawk
|
Mar 19 2022, 08:53 PM
|
Eyes on Target
|
QUOTE(FlierMate @ Mar 19 2022, 05:23 PM) Yes, that "frames='-\|/'" is one of the popular way to do it. When you mean progress indicator, do you mean this? CODE . .. ... . .. ... (and repeats)
Like a normal progress bar you see on windows when you're transferring a file. Its quite common in command line scripts now.
|
|
|
|
|