PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Loading Bar For Bash In Linux

Go down

Loading Bar For Bash In Linux Empty Loading Bar For Bash In Linux

Post by jamied_uk 17th July 2016, 20:44

Loading Bar For Bash In Linux




Code:
#/bin/bash
# Usage: ./test.sh
echo -en "\e[92mPlease Wait \c"
netstat > out.txt
count=0
total=34
pstr="[=======================================================================]"

while [ $count -lt $total ]; do
  sleep 0.1 # change speed here for faster speed use line below!
# sleep 0.06
  count=$(( $count + 1 ))
  pd=$(( $count * 73 / $total ))
  printf "\r%3d.%1d%% %.${pd}s" $(( $count * 100 / $total )) $(( ($count * 1000 / $total) % 10 )) $pstr
done
cat out.txt
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum