• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

继续同线路输出

用户头像
it1352
帮助1

问题说明

要通过打印[OK]在当一个任务完成的最后一行的末尾做一个奇特的效果。

Want to do a fancy effect by printing [OK] at the end of the last line when a task is finished.

得到这个:

echo "$0: Starting backup process in '$backupdir'... " 
sleep 3
echo '[OK]'

我尝试不同的东西在第一回波的结束,在第二个像 \\ r \\年初ç \\ ,GOOGLE了它......没有好处的。

I tried different things at the end of the first echo, at the beginning of the second like \r, \c, \, Googled it... No good.

我希望它输出这样的:

./ backup.sh:启动备份过程在'/备份'...

...和3秒后,添加 [OK]

... And 3 sec later, add the [OK]:

./ backup.sh:启动备份过程在'/备份'... [OK]

谢谢,

正确答案

#1

使用 -n 选项在最后跳过打印换行符。在 更多参考回波文档

Use the -n option to skip printing newline at the end. More reference at echo docs.

所以你可以做这样的事情:

So you could do something like this:

echo -n "$0: Starting backup process in '$backupdir'... " 

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfjeej
系列文章
更多 icon
同类精品
更多 icon
继续加载