Here are two hacks at what you are looking for:
The first will call the process (in my test case a sleep) and print # marks every second until the process ends. This bar really only gives the user a hint that something is still working. He/she has no clue how long it will take.
Code:
#!/bin/sh
sleep 8& # put the calling processes here
PROCPID=$!
while [ 1 ]; do
sleep 1
ps -ef | grep $PROCPID | grep -vq grep
if [ $? -eq 1 ]; then
break;
else
echo -n "#"
fi
done
This second attempt will display hash marks from 0% to 100%. The trick here it to know about how long the process will take. If it consistently takes about 10 seconds then add it to the AVG_TIME var. If you have no clue how long it will take then you probably should use the script above.
Code:
#!/bin/sh
COUNT=0
AVG_TIME=5
STEP=`expr 50 / $AVG_TIME`
echo " |0%--------------------50%---------------------100%|"
echo -n "Progress: "
while [ $COUNT -lt $AVG_TIME ]; do
sleep 1
HASH=0
while [ $HASH -lt $STEP ]; do
echo -n "#"
HASH=`expr 1 + $HASH`
done
COUNT=`expr 1 + $COUNT`
done