Hello,
How do i usecarriage return in ksh.
I want to do an echo "bla bla" and another echo "bla bla" will appear and replace the first echo on screen.
I tried:
until [ -z "$answer" ]; do
echo "bla bla \r"
done
please advice.
Hello,
How do i usecarriage return in ksh.
I want to do an echo "bla bla" and another echo "bla bla" will appear and replace the first echo on screen.
I tried:
until [ -z "$answer" ]; do
echo "bla bla \r"
done
please advice.
In GNU Bash:
man echo
.
.
-e enable interpretation of backslash escapes
.
.
\r carriage return
Since the OP asked, how to do it in ksh - here is, how to do it using the printf command or builtin (in ksh93):
printf "bla bla\r"
BTW: I really try to avoid using echo, because there are so many different implementations around, that it is a pain in the *** to write portable scripts.
Your original script does nothing because the "while" condition happens immediately. Suggest you have a "sleep" command in the script or you will kill your network.
#!/bin/ksh
while true
do
echo "bla bla \r\c"
sleep 1
done
Stop the script with SIGINT (usually ctrl/c).