#! /bin/bash
b=''
for ((i=0;$i<=100;i+=2))
do
printf "progress:[%-50s]%d%%\r" $b $i
sleep 0.1
b=#$b
done
echo
i=0
while [ $i -lt 20 ]
do
((i++))
echo -ne "=>\033[s"
echo -ne "\033[40;50H"$((i*5*100/100))%"\033[u\033[1D"
usleep 50000
done
echo
COUNTER=0
_R=0
_C=`tput cols`
_PROCEC=`tput cols`
tput cup $_C $_R
printf "["
while [ $COUNTER -lt 100 ]
do
COUNTER=`expr $COUNTER + 1`
sleep 0.1
printf "=>"
_R=`expr $_R + 1`
_C=`expr $_C + 1`
tput cup $_PROCEC 101
printf "]%d%%" $COUNTER
tput cup $_C $_R
done
printf "\n"
i=0
while [ $i -lt 50 ]
do
((i++))
for j in '-' '\\' '|' '/'
do
echo -ne "$j\033[s"
echo -ne "\033[40;50H"$((i*5*100/100))%"\033[u\033[1D"
usleep 50000
done
done
echo
#!/bin/bash
#Description: A shell script to copy parameter1 to parameter2 and Display a progress bar
#Author:Jacob
#Version:0.1 beta
# Read the parameter for copy,$1 is source dir and $2 is destination dir
dir=$1/*
des=$2
# Test the destination dirctory whether exists
[ -d $des ] && echo "Dir Exist" && exit 1
# Create the destination dirctory
mkdir $des
# Set counter, it will auto increase to the number of source file
i=0
# Count the number of source file
n=`echo $1/* |wc -w`
for file in `echo $dir`
do
# Calculate progress
percent=$((100*(++i)/n))
cat <<EOF
XXX
$percent
Copying file $file ...
XXX
EOF
/bin/cp -r $file $des &>/dev/null
done | dialog --title "Copy" --gauge "files" 6 70
clear
b=''
for ((i=0;$i<=100;i+=2))
do
printf "progress:[%-50s]%d%%\r" $b $i
sleep 0.1
b=#$b
done
echo
i=0
while [ $i -lt 20 ]
do
((i++))
echo -ne "=>\033[s"
echo -ne "\033[40;50H"$((i*5*100/100))%"\033[u\033[1D"
usleep 50000
done
echo
COUNTER=0
_R=0
_C=`tput cols`
_PROCEC=`tput cols`
tput cup $_C $_R
printf "["
while [ $COUNTER -lt 100 ]
do
COUNTER=`expr $COUNTER + 1`
sleep 0.1
printf "=>"
_R=`expr $_R + 1`
_C=`expr $_C + 1`
tput cup $_PROCEC 101
printf "]%d%%" $COUNTER
tput cup $_C $_R
done
printf "\n"
i=0
while [ $i -lt 50 ]
do
((i++))
for j in '-' '\\' '|' '/'
do
echo -ne "$j\033[s"
echo -ne "\033[40;50H"$((i*5*100/100))%"\033[u\033[1D"
usleep 50000
done
done
echo
#!/bin/bash
#Description: A shell script to copy parameter1 to parameter2 and Display a progress bar
#Author:Jacob
#Version:0.1 beta
# Read the parameter for copy,$1 is source dir and $2 is destination dir
dir=$1/*
des=$2
# Test the destination dirctory whether exists
[ -d $des ] && echo "Dir Exist" && exit 1
# Create the destination dirctory
mkdir $des
# Set counter, it will auto increase to the number of source file
i=0
# Count the number of source file
n=`echo $1/* |wc -w`
for file in `echo $dir`
do
# Calculate progress
percent=$((100*(++i)/n))
cat <<EOF
XXX
$percent
Copying file $file ...
XXX
EOF
/bin/cp -r $file $des &>/dev/null
done | dialog --title "Copy" --gauge "files" 6 70
clear