最佳答案
参见,http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
ANSI escape sequences allow you to move the cursor around the screen at will.
在 bash 文件中尝试这段代码
echo "1"
echo "2"
echo "3"
echo "4"
echo "5"
sleep 1
echo -n "\033[3A"
echo "magic"
echo -n "\033[u"
序列 \033[3A
将光标设置为 3 行,序列 \033[u
在打印“魔法”后恢复其位置。
关于linux - 如何在 Linux 终端中更新打印的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33351806/