#!/bin/bash # $1 = msg , $2 = count # ex) wait "Wait 5" 5 function wait() { msg=$1 count=0 total=$2 pstr="[=======================================================================]" echo $msg while [ $count -lt $total ]; do sleep 1 # this is work count=$(( $count + 1 )) pd=$(( $count * 73 / $total )) printf "\r%3d.%1d%% %.${pd}s" $(( $count * 100 / $total )) $(( ($count * 1000 / $total) % 10 )) $pstr done echo '' }