modified spin function to accept input directly
This commit is contained in:
parent
26fe977ec9
commit
e3f8e5b219
1 changed files with 11 additions and 8 deletions
11
functions
11
functions
|
|
@ -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
|
||||
# usage: spin "command [args]"
|
||||
spin() {
|
||||
sp="/-\|"
|
||||
sc=0
|
||||
spin() {
|
||||
$@ &
|
||||
_PID=&!
|
||||
while [ -d /proc/$_PID ] ; do
|
||||
printf "\b${sp:sc++:1}"
|
||||
((sc==${#sp})) && sc=0
|
||||
}
|
||||
endspin() {
|
||||
done
|
||||
printf "\r%s\n" "$@"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue