modified spin function to accept input directly

This commit is contained in:
pyr0ball 2023-03-07 15:44:00 -08:00
parent 26fe977ec9
commit e3f8e5b219

View file

@ -2,7 +2,7 @@
# pyr0ball script functions library
# Initial Vars
functionsrev=1.1.3
functionsrev=1.1.4
scriptname="${0##*/}"
rundir="${0%/*}"
rundir_absolute=$(cd `dirname $0` && pwd)
@ -555,13 +555,16 @@ ctrl_c(){
# trap ctrl_c INT # Commented out by default to prevent abnormal background exits
# Function for spinner status
sp="/-\|"
sc=0
# usage: spin "command [args]"
spin() {
sp="/-\|"
sc=0
$@ &
_PID=&!
while [ -d /proc/$_PID ] ; do
printf "\b${sp:sc++:1}"
((sc==${#sp})) && sc=0
}
endspin() {
done
printf "\r%s\n" "$@"
}