You are not logged in.
Pages: 1
Hi, now I need a script that will print a dots until it is copied and count will be max 5, where there will be more, so the dots will be deleted and re-print, like loading
I have only this, but it's not good:
#/bin/bash
count = 0
while [ cp -r /root /media/backup/ARCH ] # this is for orientation, wrong
do printf "."
(( $count++ ))
sleep 1s
if [ $count == 5 ]
then clear # this could clear 4 dots, wrong again
count = 0
fi
done
Thanks for help
Last edited by STANKAR (2010-12-28 15:32:53)
Offline
and i forgot, integer count should be in while condition with copy, but i cannot make the condition
Offline
quick n dirty... replace 'sleep 10' with whatever your long running task is.
#!/bin/bash
sleep 10 &
pid=$!
while [[ -d /proc/$pid ]]; do
(( ++dots ))
printf "\r% *s" $(( dots % 5 )) "" | tr ' ' '.'
printf "% *s" $(( 5 - dots % 5 )) ""
sleep .5s
done
echo
Last edited by falconindy (2010-12-18 19:42:20)
Offline
Offline
Wow, i think, that will be shorter code But nice job. Last thing what i need is construct while condition ...
Offline
Wow, i think, that will be shorter code But nice job. Last thing what i need is construct while condition ...
Oh god, i'm idiot, previous code is complete, no while is need. THX again falconindy
Offline
Pages: 1