Loading Bar For Bash In Linux

View previous topic View next topic Go down

Loading Bar For Bash In Linux

Post by jamied_uk on 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
avatar
jamied_uk
Admin

Posts : 2193
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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