Macos 从bash脚本中清除当前行上的所有文本
如何从bash脚本中生成ctrl u Ie我想删除一行中光标左侧的所有字符,并将光标放在第0列 解决方法可能是打印Macos 从bash脚本中清除当前行上的所有文本,macos,bash,terminal,Macos,Bash,Terminal,如何从bash脚本中生成ctrl u Ie我想删除一行中光标左侧的所有字符,并将光标放在第0列 解决方法可能是打印\r,然后清除光标右侧的内容 我不想清除整个终端屏幕 更新: 我使用的解决方案(在PHP中): 基本上你可以这样做: while :; do # an infinite loop just for demonstration echo "$RANDOM" # print your stuff here sleep 0.2 tput cuu1 # move cu
\r
,然后清除光标右侧的内容
我不想清除整个终端屏幕
更新:
我使用的解决方案(在PHP中):
基本上你可以这样做:
while :; do # an infinite loop just for demonstration
echo "$RANDOM" # print your stuff here
sleep 0.2
tput cuu1 # move cursor up by one line
tput el # clear the line
done
有关详细信息,请使用
man tput
。要查看功能列表,请使用人工终端
while :; do # an infinite loop just for demonstration
echo "$RANDOM" # print your stuff here
sleep 0.2
tput cuu1 # move cursor up by one line
tput el # clear the line
done
有关详细信息,请使用man tput
。要查看功能列表,请使用man terminfo
我在这里找到了一个有效的答案:因此我想我可以将我的问题删除为重复:-pposible duplicate of我在这里找到了一个有效的答案:因此我想我可以将我的问题删除为重复:-pposible duplicate of