I have the following code:
echo "some output"
while true ; do
echo "running"
./call-me.sh
echo "all done. ctrl+c to exit"
sleep 5
done
I want to give the user the option to exit the script without worry about failing call-me.sh
.
This scripts results in something like:
some output
running
all done. ctrl+c to exit
running
all done. ctrl+c to exit
running
all done. ctrl+c to exit
running
all done. ctrl+c to exit
running
all done. ctrl+c to exit
running
all done. ctrl+c to exit
^C
I want to only show one line in the output, either running
if call-me.sh
is running or all done. ctrl+c to exit
. I don't want to use clear
as this is a part of a script and I want to leave the rest of the output as is.
To sum up - I want to edit the last output line with new one.
So the output will be either:
some output
running
or
some output
all done. ctrl+c to exit
Ideas?
I'm going to add a "stop file". if exits the script will delete it and exit.