Hi folks,
I'm trying to write a little "progress bar" that's supposed to write a dot every second a certain process is running.
Something like:
Reading Server Status .
sleep 1 second
Reading Server Status ..
sleep 1 second
Reading Server Status ...
and so on
After the process is finished I want the $? output to be interpreted as either "ok" or "error" and put that at the end of the line. Like this:
Reading Server Status ....... error
Right now I only found a way to append a dot to the "Reading Server Status" line every second. Problem is, that I can only write a certain number of dots, AFTER that execute the process and AFTER the process finishs put an "ok" or an "error" at the end of the line. Like this:
---------------------------------------------
echo "Testing Server Status:"
sleep 2
echo "Status is \c"
sleep 1
echo ".\c"
sleep 1
echo ".\c"
sleep 1
echo ".\c"
echo ${MOJB[*]} | nohup su - ita -c "nohup testprogram" | grep "statusline" > /dev/null
if [ $? = 0 ]
then
echo " ok"
else
echo " error >"
exit
fi
---------------------------------------------
How can I change this so that the dots are being added every second AS LONG AS THE PROCESS IS RUNNING ?
Any ideas ?
Regards
Thomas
I'm trying to write a little "progress bar" that's supposed to write a dot every second a certain process is running.
Something like:
Reading Server Status .
sleep 1 second
Reading Server Status ..
sleep 1 second
Reading Server Status ...
and so on
After the process is finished I want the $? output to be interpreted as either "ok" or "error" and put that at the end of the line. Like this:
Reading Server Status ....... error
Right now I only found a way to append a dot to the "Reading Server Status" line every second. Problem is, that I can only write a certain number of dots, AFTER that execute the process and AFTER the process finishs put an "ok" or an "error" at the end of the line. Like this:
---------------------------------------------
echo "Testing Server Status:"
sleep 2
echo "Status is \c"
sleep 1
echo ".\c"
sleep 1
echo ".\c"
sleep 1
echo ".\c"
echo ${MOJB[*]} | nohup su - ita -c "nohup testprogram" | grep "statusline" > /dev/null
if [ $? = 0 ]
then
echo " ok"
else
echo " error >"
exit
fi
---------------------------------------------
How can I change this so that the dots are being added every second AS LONG AS THE PROCESS IS RUNNING ?
Any ideas ?
Regards
Thomas